Comments (5)
A sketch isn't a react component so this won't work.
You could do like the example here which uses an input to update a rotation hook value which is then passed to the sketch defined here. Wouldn't this be the solution you're looking for?
from react.
Thanks @jamesrweb Yes! I've figured this out after understanding a bit more how React lift the states up https://reactjs.org/docs/lifting-state-up.html
And p5.myCustomRedrawAccordingToNewPropsHandler
is awesome!
Can close this now (:
from react.
The actual link for examples is here
from react.
A sketch isn't a react component so this won't work.
You could do like the example here which uses an input to update a rotation hook value which is then passed to the sketch defined here. Wouldn't this be the solution you're looking for?
Unfortunately those links are no longer live, could you share them another way?
I also saw you respond in another issue that you wouldn't implement hooks without a good reason, how about this, making async web3 calls and general web3-react integration within Processing. Currently working on a project that needs this, I think it will become increasingly useful as well!
Thanks so much
EDIT:
Ok I found the new path to the examples you linked and was able to pass in a function from the parent component that calls the hook and that worked!
from react.
Updated the links for future references to be in tact. 👍🏻
from react.
Related Issues (20)
- Migrate to Vite and Vitest
- Migrate to the @P5-wrapper npm org
- Loading image P5-react
- React's strict mode causes the canvas to be created twice HOT 4
- An example of exposing imperative methods from the sketch? HOT 9
- unexpected array behavior inside p5 sketch function HOT 1
- ReactP5Wrapper has additional pixels in height HOT 3
- Could not find a declaration file but the code works HOT 10
- Duplicate canvas when running in vite dev HOT 5
- TypeError: p5.loadSound is not a function HOT 3
- P5-wrapper size HOT 5
- Stop rerender of p5 component when redux variables update HOT 3
- Latest commits not in the npm registry HOT 5
- Issue building with Vite 5 HOT 16
- npm ERR! Usage Error: This project is configured to use npm HOT 2
- windowResized() not firing HOT 4
- Error in nextjs HOT 7
- Change p5 dependency version to minimum 1.4.1 HOT 9
- Examples directory doesn't exist, link broken on README HOT 3
- Module parse failed: Identifier 'XX' has already been declared (7762:41) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.