react-hooks icon indicating copy to clipboard operation
react-hooks copied to clipboard

useReplicant doesn't support passing a function to setReplicant

Open FunctionDJ opened this issue 4 years ago • 0 comments

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.

FunctionDJ avatar Mar 04 '21 08:03 FunctionDJ