File tree Expand file tree Collapse file tree 3 files changed +10
-11
lines changed
Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 11# React Stepper
22[ ![ Node.js CI] ( https://github.com/omarnyte/react-stepper/actions/workflows/test.yml/badge.svg )] ( https://github.com/omarnyte/react-stepper/actions/workflows/test.yml )
3-
43[ ![ npm version] ( https://badge.fury.io/js/@xolos%2Freact-stepper.svg )] ( https://badge.fury.io/js/@xolos%2Freact-stepper )
54
65A simple, flexible React step wizard hook.
@@ -44,19 +43,19 @@ export default App;
4443## API
4544``` jsx
4645const {
47- currentStepId ,
48- currentStepIndex ,
49- goToNextStep ,
50- goToPreviousStep ,
51- isFirstStep ,
52- isLastStep
46+ currentStepId ,
47+ currentStepIndex ,
48+ goToNextStep ,
49+ goToPreviousStep ,
50+ isFirstStep ,
51+ isLastStep
5352} = useStepper (stepIds)
5453```
5554### Options
56- * ` stepIds: string[] `
55+ * ` stepIds: Array< string | number> `
5756
5857### Returns
59- * ` currentStepId: string `
58+ * ` currentStepId: string | number `
6059
6160* ` currentStepIndex: number `
6261
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import useStepper from './index';
33
44
55describe ( 'useStepper' , ( ) => {
6- const stepIds = [ 'first' , 'second' , 'third' ] ;
6+ const stepIds = [ 'first' , 2 , 'third' ] ;
77
88 it ( 'begins at first step' , ( ) => {
99 const { result } = renderHook ( ( ) => useStepper ( stepIds ) ) ;
Original file line number Diff line number Diff line change 11import { useState } from "react" ;
22
3- const useStepper = ( stepIds : string [ ] ) => {
3+ const useStepper = ( stepIds : Array < string | number > ) => {
44 const [ currentStepIndex , setCurrentStepIndex ] = useState ( 0 ) ;
55
66 const currentStepId = stepIds [ currentStepIndex ] ;
You can’t perform that action at this time.
0 commit comments