-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
breaking: make it compatible with memo and react compiler #202
Conversation
dai-shi
commented
Mar 2, 2024
•
edited
Loading
edited
- impl
- docs
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
I just tried beta.3 in our repo from work. Admittedly we haven't used "memo" from react-tracked, only "createContainer" to avoid extra rerenders. Everything works just like before, avoiding any extra rerenders. I haven't found any issues with 2.0. Not sure how common my use-case is but we do something like this, putting the update function into the state object itself: const useFormStateValue = ({ state }) => {
return [state, _.noop];
};
const { Provider, useTrackedState } = createContainer(useFormStateValue);
const Form = ({ values, setValues }) => {
return (
<Provider state={{ values, setValues }}>
{...}
</Provider>
);
} Form components like radiobuttons and text boxes then use |
Thanks for confirming. Yes, the core change in this PR is subtle, and unless people use |