31
loading...
This website collects cookies to deliver better user experience
Step
. This approach has also proved itself to be very cumbersome. I even had trouble using the library in a project at work because of this.children
prop. Using React.Children
method, I was able to treat the direct siblings of the main wrapper component as steps. Step
component brought about a problem that I really enjoyed solving.Step
component was providing some useful props such as next
, prev
, jump
methods that are used to navigate between steps. Now I had to serve these methods in a different way.useSteps
that provides all the properties and methods that were shared via Step
component's props before.Steps
wrapper should be wrapped in StepsProvider
component for this to work and at first I didn't really like the idea of forcing the developers to use another wrapper component. However, being free from a special component's props and being able to use those methods anywhere under the provider's tree was the flexibility I wanted. So I went with the StepsProvider
solution where the data is shared through React's Context API.