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

False negatives in tracking with React.memo #21

Closed
dai-shi opened this issue Oct 6, 2019 · 0 comments · Fixed by #22
Closed

False negatives in tracking with React.memo #21

dai-shi opened this issue Oct 6, 2019 · 0 comments · Fixed by #22

Comments

@dai-shi
Copy link
Owner

dai-shi commented Oct 6, 2019

Just tried to imeplement ToDo app with useReducer pattern.
With React.memo, I found a huge limitation in the current implementation.

If tracking finds both todo object and todo.id are used, todo is checked for ref equality in memo, we have false negatives (no render).

More investigation needed. (Like why js-framework-benchmark is working.)


There are two issues.

  1. use a property in callback
onChange={() => dispatch({ type: 'TOGGLE_TODO', id: todo.id })}
  1. use a property for key
<TodoItem key={todo.id} todo={todo} />
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

Successfully merging a pull request may close this issue.

1 participant