Doesn't work as expected with React.memo
See original GitHub issueWhen I try to wrap a functional component with React.memo
I get <[object Object] />
instead of the component name.
The output without React.memo
is:
The output with React.memo
is:
storiesOf('My component', module)
.addDecorator(jsxDecorator)
.add('default', () => (
<MyComponent>
<span>Some text content</span>
</MyComponent>
));
- react: 16.8.6
- storybook: 5.1.11
- storybook-addon-jsx: 7.1.6
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (1 by maintainers)
Top Results From Across the Web
React.memo isn't working - what am I missing? - Stack Overflow
I'm obviously missing something here or don't quite understand how this works. This component is a few levels down, but it passes in...
Read more >How to use React.memo() to improve performance
The reason React.memo doesn't work anymore is because it only does a shallow comparison of the component's properties.
Read more >memo - React Docs
With memo , you can create a component that React will not re-render when its parent re-renders so long as its new props...
Read more >Use React.memo() wisely
You gain a performance boost: by reusing the memoized content, React skips rendering the component and doesn't perform a virtual DOM difference ...
Read more >When should you use React.memo and useMemo?
useMemo is a hook that gets run during the render stage and also ... Example 5 // WRONG, does not work as expected...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Try
I’ve been meaning to toy around with writing a better displayName babel plugin, but until then manually setting the name works pretty well. NOTE: This can also be easily overriden