Skip to content

great idea for the warning! #11

@gcloeval

Description

@gcloeval

This few lines here:

if (process.env.NODE_ENV !== "production") {
                const check = mapStateRef.current(state);
                if (!is(check, res)) {
                    console.warn(
                        "useMapState returns new identity on every run. This causes the component to render on every Redux state change. Consider use using useSelect().",
                        res,
                    );
                }
            }

this is so so excellent. You have saved me so much time. It cought every single place I mistankely was returning new identities and/or in general misconfiguring stuff. I know you are sort of using this as a prototyping for official redux hooks, so I just want to encourage you that this sort of warning is also included there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions