Take Workshop
Ask a Question
·
Report Bug
Hooks are awesome because they're "first-class" utility functions provided by React to let you hook into state and other features while writing components. The cool thing about Hooks is that you can build on top of them to make your own. It’s like writing a function on top of lodash. You can gather something that might be reusable, and then package it up into a custom hook. That is the beauty of writing a shareable custom Hook in React.
After completing this workshop, you will understand how to write custom Hooks in React, and publish them as npm packages for the open source community.
By taking this workshop, you will learn how to:
- Understand what a “first-class” Hook is and isn’t
- Understand what a custom Hook is
- Write a custom Hook in an existing application
- Extract the Hook into a module
- Test the Hook locally
- Publish the Hook as an npm package
Although this workshop is not targeted at React experts you'll need the following:
- moderate React experience
- some familiarity with Hooks
- an npm account
Before you join us for the workshop, please make sure to the following:
- Download Zoom
- Clone this repo so you have it locally
- Create an npm account (needed to publish your package)
- Install
create-react-hook
globally
npm i -g create-react-hook
yarn add global create-react-hook
- or you can run it during the workshop using `npx create-react-hook
If you run into road blocks at anytime in the workshop or want additional resources, here's a list of things to check out:
- Wrapping your head around the bundle outputs.
- Know why / how you shouldn’t bundle React
- Hook inspiration and deciding what to make a hook of
- Default exports and named exports
- Understanding how Hooks work