Skip to content

useReplicant doesn't support passing a function to setReplicant #227

Closed
@FunctionDJ

Description

@FunctionDJ

An example with useState and useReplicant:

const [data, setData] = React.useState(0);
setData(previousData => previousData + 1);

const [replicant, setReplicant] = useReplicant(0);
setReplicant(previousData => previousData + 1); // this is not supported!

Would be great if that was supported, because old values could be captured when using useEffect for example.

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