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

useStateList with defaultCurrentIndex

Open peacetrue opened this issue 9 months ago • 0 comments

Is your feature request related to a problem? Please describe. When I want to set the default currentIndex, does it require an extra state update?

Describe the solution you'd like

  const defaultCurrentIndex = 1;
  const stateList = useStateList([0,1,2],defaultCurrentIndex);

Describe alternatives you've considered

  const defaultCurrentIndex = 1;
  const stateList = useStateList([0,1,2]);
  useEffect(() => {
    stateList.setStateAt(defaultCurrentIndex);
  }, []);

peacetrue avatar May 18 '25 04:05 peacetrue