Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any plans to implement react hooks? #31

Closed
vennsoh opened this issue Jun 3, 2019 · 4 comments
Closed

Any plans to implement react hooks? #31

vennsoh opened this issue Jun 3, 2019 · 4 comments
Labels

Comments

@vennsoh
Copy link

vennsoh commented Jun 3, 2019

Are there any future plans to refactor the code to use hooks and all the latest React goodness? I found one here which looks very promising but it's way to complex for a novice like me. https://discourse.processing.org/t/using-react-with-p5-js-es6-support/

@and-who
Copy link
Contributor

and-who commented Jun 3, 2019

I wouldn't add it just because.
If somebody comes up with a good reason, perhaps :)

@vennsoh
Copy link
Author

vennsoh commented Jun 4, 2019

I'm not super familiar with all things react but I heard react-p5-wrapper uses componentWillReceiveProps(). Since React 16.3 it has been replaced by UNSAFE_componentWillReceiveProps()? This lifecycle method is deprecated and will be removed from the next major release of React?

@and-who
Copy link
Contributor

and-who commented Jun 4, 2019

@vennsoh ohhh I didn't think of that, Thx!
I just build a Version 2.0.0 where it uses the getDerivedStateFromProps(props, state)-Function instead. (npm Repo)
I didn't tested it very well. But from the first glance it should work.

@Maybach91
Copy link

Thanks @and-who, how to use this? The same like in the mentioned processing reference?
<P5Wrapper sketch={sketch} foo="bar" /> does not work for me. i need to access foo within my sketch module. :/

@and-who and-who closed this as completed Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants