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

creatibutors: refactor state management in components #422

Open
slint opened this issue Feb 21, 2022 · 0 comments
Open

creatibutors: refactor state management in components #422

slint opened this issue Feb 21, 2022 · 0 comments

Comments

@slint
Copy link
Member

slint commented Feb 21, 2022

The current ref-based implementation for updating the render state of some underlying components is a sign that the state should be handled by the upper component.

If you remove the state selectedOptions from CreatibutorsIdentifiers, and you manage it in this component, we should only need something like:

this.setState({selectedIdentifer: ....})

In the render method, we pass it as a prop, so that CreatibutorsIdentifiers will re-render with this new selectedIdentifier. We will also handle the callbacks and formik set in the upperCmp: the inner one will become very dummy.

If the logic in this upper becomes very messy, you can always introduce a middle component, between the 2, where the middle one encapsulates/manages the state of the inner one and the upper one is a bit lighter...

There's a similar approach in the PIDs component.

Originally posted by @ntarocco in #410 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant