2020-04-14 07:52:18 +08:00
..
2020-02-25 11:52:35 -05:00
2020-04-14 07:52:18 +08:00
2020-02-25 11:52:35 -05:00
2020-02-25 11:52:35 -05:00
2019-06-11 18:47:11 +02:00

storybook-addon-queryparams

This storybook addon can be helpful if your components need special query parameters to work the way you want them.

Getting started

First, install the addon.

$ yarn add @storybook/addon-queryparams --dev

Add this line to your main.js file (create this file inside your storybook config directory if needed).

module.exports = {
  addons: ['@storybook/addon-queryparams'],
};
import React from 'react';
import { storiesOf } from '@storybook/react';

storiesOf('button', module)
  .addParameters({
    query: {
      mock: true,
    }
  })
  .add('Prints the document.search', () => (
    <div>
      This is the current document.search: {document.search}, it includes `mock`!
    </div>
  ));