Skip to content

Instantly share code, notes, and snippets.

@lightsound
lightsound / createStorybookFactory.tsx
Created January 12, 2022 11:40
Storybookのテンプレートを削減するためのファクトリー関数
import { AnyFramework, ComponentTitle, StoryAnnotations } from '@storybook/csf'
import { ComponentMeta, ComponentStory } from '@storybook/react'
import { VFC } from 'react'
export const createStorybookFactory = <P extends object>(Component: VFC<P>) => {
const Template = ((args) => <Component {...args} />) as ComponentStory<
typeof Component
>
const Default = Template.bind({})