Skip to content

How would you handle navigation from inside a story? #52

Answered by JesusTheHun
todor-a asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

I wish to load a different story upon clicking a link

To be specific, you want to navigate through the storybook or just render a different component at the same place ?

The former is not possible, the latter is just conventional routing :

export const RouteWithChildren = {
  render: () => (
    <main>
      <h1>List of items</h1>
      <ul>
        <li>
          <NavLink to={'42'}>Book 42</NavLink>
        </li>
      </ul>

      <Outlet />
    </main>
  ),
  parameters: {
    reactRouter: reactRouterParameters({
      location: {
        path: '/book',
      },
      routing: {
        path: '/book',
        useStoryElement: true,
        children: [
          {
            path: 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@todor-a
Comment options

Answer selected by todor-a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants