custom widgets and React.memo
See original GitHub issuePrerequisites
- I have read the documentation;
- In the case of a bug report, I understand that providing a SSCCE example is tremendously useful to the maintainers.
- Ideally, I’m providing a sample JSFiddle or a shared playground link demonstrating the issue.
Description
Looks like the widgets props doesnt like react.memo Components for some reason.
Steps to Reproduce
Once wrapped in React.memo the component is not usable anymore as a form widget. this also impacts react-redux connect wrapper with produces a React.memo 😃
Here’s a repro : https://codesandbox.io/s/reactredux-connect-with-reactjsonschemaform-issue-8023j
Expected behavior
React memoified components should work 😃
Actual behavior
Throws with Unsupported widget definition: object
Version
1.6.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:16 (10 by maintainers)
Top Results From Across the Web
Use React.memo() wisely
memo () does a shallow comparison of props and objects of props. To customize the props comparison you can use the second argument...
Read more >How React.memo works? - Reintroducing React: V16 and ...
In this lesson, we'll discuss how React.memo works. ... All you do is wrap your functional component in the React.memo function call and...
Read more >React.memo() vs. useMemo()
It offers React.memo() and useMemo() to implement memoization. ... you can also pass a custom comparison function as the second argument as shown...
Read more >Optimize Components with React.memo, useMemo, and ...
Learn how to optimize components in React.memo, useMemo, and useCallback ... If this component renders and the value of widgets is the same, ......
Read more >Use React Memo to Optimize Performance, Save
Optimize React Performance with React Memo and Save $$$ by Caching ... What is React.memo(); How to use React.memo(); Custom Prop Equality: ...
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

Simple workaround for now if you’re using redux connected components -
At the bottom of your custom widget component change:
export default connect(mapStateToProps)(ContractCategorySuperSelect)to:
Essentially just returning a standard react component with the redux connected component inside it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you.