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

Unexpected behavior when use React.forwardRef with React.createContext #12688

Closed
dive2Pro opened this issue Apr 25, 2018 · 2 comments
Closed

Comments

@dive2Pro
Copy link

Do you want to request a feature or report a bug?
bug
What is the current behavior?
example: https://codesandbox.io/s/04393o3k6w
If the LogProps is child of M.Provider, and M.Consumer is used in its children.
When the M.Provider is updating, even if the LogProps is wrapped in a component that never updates, it can still be triggered by the callback of React.forwardRef, and updates the LogProps.

What is the expected behavior?
the LogProps shouldn't update when the root component had updated, whether or not M.Consumer is used in its children;

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

it's used react@16.3

@gaearon
Copy link
Collaborator

gaearon commented Apr 25, 2018

I think this might be a bug.

@gaearon
Copy link
Collaborator

gaearon commented May 24, 2018

Should be fixed in React 16.4.
https://reactjs.org/blog/2018/05/23/react-v-16-4.html

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

No branches or pull requests

2 participants