git clone git@github.com:cvazac/test-ref-pattern.git
cd test-ref-pattern
npm install
npm start
Explore to the codesandbox.io workspace.
npm install
npm start
Manually edit PatternComponent
component and explore to http://localhost:3000/.
The render()
method of PatternComponent
must include <ChildComponent/>
in its return value.
You will see that the following snippet forces a needless re-render of ChildComponent
.
<ChildComponent prop={{}} />
In the following snippet, we refactor to prevent the needless re-render:
<ChildComponent prop={static_empty_object} />