Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Why you do not set the state directly in React. For example, if you have const [products, setProducts] = useState([]). Why you do not set products = [...] instead, you use the setProducts

Abdur Rahim answered on May 27, 2022 Popularity 6/10 Helpfulness 1/10

Contents


More Related Answers

  • You're importing a component that needs useState. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.
  • react native can't set state in styles
  • why usestate and not variables react
  • class component react using state
  • can we use setstate inside build
  • how to update state.item[1] in state using setState? React
  • set state using object
  • set state
  • setting state immediately in React js
  • const inc_5=()=>{ for(let i=0;i<5;i++){ setState(state=>state+1) } }explain
  • can we add new state property using setstate in react

  • Why you do not set the state directly in React. For example, if you have const [products, setProducts] = useState([]). Why you do not set products = [...] instead, you use the setProducts

    0
    Popularity 6/10 Helpfulness 1/10 Language typescript
    Link to this answer
    Share Copy Link
    Contributed on May 27 2022
    Abdur Rahim
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.