Skip to content

Instantly share code, notes, and snippets.

@simbathesailor
Created December 24, 2019 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simbathesailor/63ed95843e4b5f115f99468c3eaa039a to your computer and use it in GitHub Desktop.
Save simbathesailor/63ed95843e4b5f115f99468c3eaa039a to your computer and use it in GitHub Desktop.
Hooks passing callbacks
function App() {
// Notice the callback passed to component will be a new reference
// on every rerender for both the callbacks
function callback() {
// some logic
}
function callback2() {
// some logic
}
return <SomeChildComponent callback={callback} callback2={callback2} />;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment