Skip to content

Instantly share code, notes, and snippets.

@sag1v
Created October 19, 2018 09:14
Show Gist options
  • Save sag1v/0d7c832900d3544615da7e6f2f1c97bd to your computer and use it in GitHub Desktop.
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)
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