You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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...
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
fromCreatibutorsIdentifiers
, and you manage it in this component, we should only need something like:In the render method, we pass it as a prop, so that
CreatibutorsIdentifiers
will re-render with this newselectedIdentifier
. 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)
The text was updated successfully, but these errors were encountered: