Skip to content

Conversation

shifluxxc
Copy link

@shifluxxc shifluxxc commented Jun 11, 2025

Description

Fixes : #2637
This PR adds support for initializing the useStateList hook with a default index addressing the issue #2637 .
You can now pass a second argument to useStateList to specify the initial index, e.g. useStateList(['a', 'b', 'c'], 1) will start at 'b'.
The test suite has been updated to cover this new behavior and ensure backward compatibility.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as before)

Checklist

  • Read the Contributing Guide
  • Perform a code self-review
  • Comment the code, particularly in hard-to-understand areas
  • Add documentation
  • Add hook's story at Storybook
  • Cover changes with tests
  • Ensure the test suite passes (yarn test)
  • Provide 100% tests coverage
  • Make sure code lints (yarn lint). Fix it with yarn lint:fix in case of failure.
  • Make sure types are fine (yarn lint:types).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

useStateList with defaultCurrentIndex

1 participant