storybook/docs/snippets/react/my-component-with-env-variables.ts.mdx

21 lines
497 B
Plaintext

```ts
// MyComponent.stories.tsx
import React from 'react';
import { Story, Meta } from '@storybook/react/types-6-0';
import { MyComponent, MyComponentProps } from './MyComponent';
export default {
component: MyComponent,
title: 'A story using environment variables inside a .env file',
} as Meta;
const Template: Story<MyComponentProps> = (args) => <MyComponent {...args} />;
export const Default = Template.bind({});
Default.args = {
propertyA: process.env.STORYBOOK_DATA_KEY,
};
```