storybook/docs/snippets/react/my-component-with-env-variables.mdx.mdx
2021-01-20 11:06:53 +08:00

22 lines
515 B
Plaintext

```md
<!-- MyComponent.stories.mdx -->
import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
import MyComponent from './MyComponent';
<Meta title="A MDX story using environment variables inside a .env file" />
export const Template = (args) => <MyOtherComponent {...args} />
<Canvas>
<Story
name="A MDX story using environment variables inside a .env file"
args={{
propertyA: process.env.STORYBOOK_DATA_KEY}}
>
{Template.bind({})}
</Story>
</Canvas>
```