Is there a way to use p5.js in a react native app? Found an old post from 2017 that said it was not possible. But many things changed on both front since then and i am new go this. Any guidance would be helpful
Asked
Active
Viewed 1,697 times
5
-
7I'm sure it's always been possible, you just need to manage a canvas, right? Check out https://www.npmjs.com/package/react-p5-wrapper – Drew Reese Feb 08 '21 at 01:03
-
2In addition to Drew's link you might want to check [this repo](https://github.com/Gherciu/react-p5) or [this one](https://github.com/atorov/react-p5js) on github. – statox Feb 08 '21 at 10:25
-
None of the previous suggestions work with React-native - just React ( which is different) -- the only thing that I have found that is close is https://github.com/expo/expo-processing – MarkM Dec 29 '22 at 03:17
1 Answers
0
In addition to the comments with very useful repositories/libraries, you may want to know this:
- p5.js could need the
window
object to be initialised. Not compatible with Server Side Rendering (SSR), for example. - You can still import p5.js lazily (see
import(...)
syntax for example) once the page is loaded on the client's side, and pass it a canvas as a ref, but this will require some async logic, which is not always a breeze in React.

RemyDekor
- 66
- 3