Build your own guide component (headless)
How to build custom guide component using our React hooks and client library.
Using our @knocklabs/react
and @knocklabs/client
libraries, you can create fully custom guide components that are backed by the Knock Guide API and real-time service.
Other cases#
Rendering multiple guides#
If you want to fetch multiple guides of the same message type, you can use the useGuides
hook for use in your component.
Typing the guide step content#
If you're using a custom message type, you can type the guide step content to ensure type safety.
GuideClient
Advanced: working with the #In certain cases, you may need to drop down to operate on the guide client, which is the state management layer automatically created when you mount a GuideProvider
.
You can always access the guide client by using the useGuideContext
hook:
One use case for accessing the guide client is to force a refetch of the users eligible guides, which you can do through the guideClient.fetch()
method.