diff --git a/react-hooks.md b/react-hooks.md index 69a2b2d..81fb8ac 100644 --- a/react-hooks.md +++ b/react-hooks.md @@ -1,13 +1,12 @@ ### React Hooks -> **Note**: Hooks are still an **experimental proposal, available in an alpha release**. The API will likely change. Keep that in mind as you try them out. - +> Hooks were an experimental proposal, available in an alpha release up until the [release of React 16.8](https://reactjs.org/blog/2019/02/06/react-v16.8.0.html). They allow use of state and other React features like lifecycle events from within a functional component rather than a class. Hooks also allow you to share reusable stateful logic between components. Hooks are JavaScript functions, the [rules of Hooks](https://reactjs.org/docs/hooks-rules.html) should be understood and are covered in the React Docs. #### Official Resources - **React Docs: Hooks (Proposal)** https://reactjs.org/docs/hooks-intro.html - The main resource for learning hooks. Includes an intro with motivation, tutorials on `useState` and `useEffect`, discussion of custom hooks, the full hooks API reference, and an in-depth FAQ. **Read the hooks docs first before looking at anything else!** + The main resource for learning hooks. Includes an intro with motivation, tutorials on `useState` and `useEffect`, discussion of custom hooks, the full hooks API reference, and an in-depth FAQ. **Read the Hooks docs before anything else!** - **ReactConf 2018: React Today and Tomorrow** https://www.youtube.com/watch?v=dpw9EHDh2bM @@ -17,7 +16,6 @@ https://dev.to/dan_abramov/making-sense-of-react-hooks-2eib Dan Abramov provides a lot of additional context around the hooks proposal, including potential benefits like co-locating related logic, examples of how to use hooks, whether they are "magic", and more. **Also a must-read.** - #### Hooks Tutorials - **A Simple Intro to React Hooks** @@ -36,6 +34,17 @@ https://www.fullstackreact.com/articles/an-introduction-to-hooks-in-react/#community-reaction-to-hooks An extensive article with numerous examples of `useState`, `useEffect`, and `useContext`. Also covers `useRef`, custom hooks, writing tests for hooks, and some community reactions. +- **How to Use Basic React Hooks for Context** + https://www.telerik.com/blogs/how-to-use-basic-react-hooks-for-context + After tackling the basics of `useState` and `useEffect` we can see how the React Context API is used in the context of React Hooks. + +- **Everything You Need to Create a Custom React Hook** + https://www.telerik.com/blogs/everything-you-need-to-create-a-custom-react-hook + An article focusing on the basic rules for creating simple custom React Hooks from a beginners level perspective. + +- **How to Use Basic React Hooks for Reducers** + https://www.telerik.com/blogs/how-to-use-basic-react-hooks-for-reducers + Understand how to make the jump between `useState` and `useReducer` while building a simple Todo application. #### Understanding Hooks Internals @@ -54,3 +63,7 @@ - **React RFC #68: React Hooks** https://github.com/reactjs/rfcs/pull/68 The official RFC announcing hooks. There's hundreds of comments from the community debating various pros and cons of the API design. Probably not worth reading the entire thread, but some interesting thoughts in there. + +- **Why React Hooks, and how did we even get here?** + https://medium.freecodecamp.org/why-react-hooks-and-how-did-we-even-get-here-aa5ed5dc96af + This article explores how React Hooks have learned from the trade-offs of mixins, HOC's, and render props bringing us new ways to create contained, composable behaviors consumable in a flat and declarative manner. \ No newline at end of file