Code Monkey home page Code Monkey logo

react-the-complete-guide's Introduction

Create a new App

  • npm create vite
  • npm install
  • npm run dev

Extra packages

  • npm install styled-components
  • npm install -D tailwindcss postcss autoprefixer -> npx tailwindcss init -p
  • npm install million
  • npm install redux react-redux
  • npm install @reduxjs/toolkit
  • npm install react-router-dom
  • npm install @tanstack/react-query

Rules of Hooks

  • must not call React Hooks outside of the component function.
  • must not call React Hooks inside of if statements.
  • must not call React Hooks inside of nested functions.

Notes

  • Hooks: must be used directly in the root level of the component function.
  • Key prop on a component that is not a part of a list: whenever it changes, react will destroy the old component instance and create a new one.
  • useRef: use refs for managing values that are stored and managed independently from the component function lifecycle to which they belong.
  • Memo: prevents functional components executions that are triggered from the parent component. You might avoid it by clever component structuring.
  • useMemo: prevents function execution, only re-executeif one of the dependencies is changed.
  • useCallback: used to avoid recreation of a function.
  • Prop drilling = passing shared data through multiple components layers even tho most components don't directly need that data (just pass it on to the child component).
  • Component composition = one way to solve prop drilling, the middle component act as a wrapper.
  • Don't do side effects (async code) inside reducers.
  • Thunk: is a function that delays an action until later.
  • Index routes: allows you to define the default route that should be loaded if the parent routes path is active.
  • useLoaderData: you can access loaded data with help of useLoaderData in any component on the same level or lower level.
  • useFetcher: use it if you wanna trigger a loader or an action without actually loading the page, the route to which this action or loader belongs.

react-the-complete-guide's People

Contributors

millaniasameh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.