Description
We've all heard of "custom hooks" before but many people still learning React find them intimidating... Tagged with react, hooks, javascript, tutorial.
Summary
- We've all heard of "custom hooks" before but many people still learning React find them intimidating (speaking from personal experience!)
- Message Component + API Looking at the props we can see that the Message component needs the following props in order to be customized...Note: We then create our piece of state (using an object) and fill it will all the info that we need to customize our Message via props.
- Create two helper functions to manipulate the state so when we are using the hook we don't have call the setter or the setTimeout directly making it cleaner and easier to use.