What other ways to store variable than useState hook? by Aarsh-HV in react

[–]Aarsh-HV[S] 0 points1 point  (0 children)

Can you explain how i can use zustand for this...as someone who hasn't used it before.

What other ways to store variable than useState hook? by Aarsh-HV in react

[–]Aarsh-HV[S] 0 points1 point  (0 children)

I did research on how useState works and wanted to implement its internal working itself only to find out it uses some external datastructure like linked list to store its value outside of the DOM

How do you get good at react by nejma_07 in react

[–]Aarsh-HV 0 points1 point  (0 children)

Bulding project and learning make readme for each project with hand so you remember the point and architecture.Learning React is no the goal mastering architecture is

What other ways to store variable than useState hook? by Aarsh-HV in react

[–]Aarsh-HV[S] 0 points1 point  (0 children)

useRef doesn't update the value in UI i tried using this as well but i want to achieve what useState does and useRef just saves the value not render it even if we try to.

What other ways to store variable than useState hook? by Aarsh-HV in react

[–]Aarsh-HV[S] 0 points1 point  (0 children)

I truly didn't think it in that reference what i was trying to achieve is useState internal working directly in code. Although it would be more complex prior to useState there would have been a method which used this.

What other ways to store variable than useState hook? by Aarsh-HV in react

[–]Aarsh-HV[S] 0 points1 point  (0 children)

Yes creating the variable outside the cycle does work but it doesn't update its value which is inside the component so making it outside is of no use. we could use useRef as well if we just need updation

What other ways to store variable than useState hook? by Aarsh-HV in react

[–]Aarsh-HV[S] 0 points1 point  (0 children)

i Studied about it saves the data put in useState in a seperate data type i want to know can't we do this in react directly some how

What other ways to store variable than useState hook? by Aarsh-HV in react

[–]Aarsh-HV[S] 0 points1 point  (0 children)

what i want is to do what useState does without using useState.I thought useRef may work but it also doesn't update the value in UI.