Skip to content

Instantly share code, notes, and snippets.

@razum2um
Forked from gaearon/MyResponsiveComponent.js
Created February 20, 2019 10:44
Show Gist options
  • Save razum2um/3844ca82392c5f999e3320a439c5e8f9 to your computer and use it in GitHub Desktop.
Save razum2um/3844ca82392c5f999e3320a439c5e8f9 to your computer and use it in GitHub Desktop.
Examples from "Making Sense of React Hooks"
function MyResponsiveComponent() {
const width = useWindowWidth(); // Our custom Hook
return (
<p>Window width is {width}</p>
);
}
function MyResponsiveComponent({ width: useWindowWidth }) {
return (
<p>Window width is {width}</p>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment