Skip to content

Question: Why do hooks useRef instead of useState #719

@mfbx9da4

Description

@mfbx9da4

I've noticed for a few state libraries, including zustand, use useRef, diff the previous value and then forceRender(), instead of leaving this to useState which does all this for free. Why is that?

My guess it's something to do with isomorphic layouts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions