Closed Tjorriemorrie closed 8 years ago
I think the forceUpdate()
call should be in the top most App component.
react-pure-render
should be used for other pure components (whose render()
function only depends on this.state
and this.props
), for example TodoList
and Footer
in freezer-todomvc.
See my Footer
code which uses PureRenderMixin
.
(TodoItem
is also pure but it is already bound by TodoList, so we don't have to implement its shouldComponentUpdate()
)
OK, so I assume it's useless then because of how freezer works. Thanks for the advice.
@Tjorriemorrie there is no problem using freezer and react-pure-render together. Your freezer store should be read by your top component (as @leesei recommends ) and its data is passed down through its children props. Only this top component should use the forceUpdate
snippet to make your app reactive.
All the children should receive the data from their props and they can be pure components, getting the benefit of using react-pure-render.
I've updated my comment.
@arqex do you think my commit is useful for freezer-todomvc?
I can create PR after changing dependency to react-pure-render
.
Does this library work with react-pure-render?
I've tried:
instead of:
But it didn't trigger an update.