Created
October 19, 2018 09:14
-
-
Save sag1v/0d7c832900d3544615da7e6f2f1c97bd to your computer and use it in GitHub Desktop.
A HOC that injects a key to a react component (forcing a re-mount)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const withRemount = (Component, key) => (props) => { | |
const asKey = props[key]; | |
return <Component key={asKey} {...props} /> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment