Documentation Index
Fetch the complete documentation index at: https://gusto-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Required knowledge
Before starting, you might consider familiarizing yourself with documentation around composition, workflows, and event handling.Overview
For this exercise we’ll be creating the Employee Self Onboarding flow in React Router. Employee Self Onboarding is comprised of the following steps:Employee which can be imported as follows:
Creating the routes
Let’s create a simple router. This router will take the employee id and company id as parameters. We will then create a route corresponding to each step outlined above. Note: we’ll add the actual elements in the next step.Creating components with navigation
Each component in the React SDK has an onEvent property.onEvent is fired when the users perform various actions for the SDK components (read more in the Event Handling documentation). When a component is ready for navigation, an event will be fired. We can hook into the event and configure our navigation.
In our first step in our flow, Employee.Landing, the EMPLOYEE_SELF_ONBOARDING_START event is fired when we are ready to proceed with the flow.
We can create a wrapper component around Employee.Landing and execute routing per our declared routes above when onEvent is fired with the EMPLOYEE_SELF_ONBOARDING_START event.
Putting it all together
Once we have our wrapper components configured with the correct navigation, we can supply them to our router that we configured in the first step. Here’s the full example with navigation configured for each step:What’s Next