Skip to content

Instantly share code, notes, and snippets.

@HarunMbaabu
Last active April 5, 2021 17:56
Show Gist options
  • Save HarunMbaabu/2bda1512f5be9ac3d5929d3742060114 to your computer and use it in GitHub Desktop.
Save HarunMbaabu/2bda1512f5be9ac3d5929d3742060114 to your computer and use it in GitHub Desktop.

React File Structure

react-todo-app
    ├── node_modules
    ├── public
    │    ├── favicon.ico
    │    ├── index.html
    │    ├── logo192.png
    │    ├── logo512.png
    │    ├── manifest.json
    │    └── robots.txt
    ├── src
    │    ├── App.css
    │    ├── App.js
    │    ├── App.test.js
    │    ├── index.css
    │    ├── index.js
    │    ├── logo.svg
    │    ├── reportWebVitals.js
    │    └── setupTest.js
    ├── .gitignore
    ├── package.json
    ├── README.md
    └── yarn.lock

ReactHooks

React Hooks (introduced in React since version 16.8) are JavaScript functions that allow us to build our React component ONLY with function.

It’s birth to solve some of the complications associated with the class logic.

Basic Hooks

  • useState
  • useEffect
  • useContext

Additional Hooks

  • useReducer
  • useCallback
  • useMemo
  • useRef
  • useImperativeHandle
  • useLayoutEffect
  • useDebugValue

useState

const [state, setState] = useState(initialState);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment