Recently I have started learning to react Storybook. In the below example, when I don't write {}
in Template.bind({})
, the Storybook will run absolutely fine without any error. But I have found that many of the people use {}
in Template.bind({})
while making stories.
Question: Is it necessary to have {}
inside Template.bind({})
while making stories in Storybook?
import React from 'react'
import { MyButton } from './MyButton'
export default {
title : 'MyButton',
component : MyButton
};
const Template = (args) => <MyButton {...args}/>
export const Primary = Template.bind()
Primary.args = {
variant: 'primary',
label: 'button'
}
Template.bind({})
is a waste of time/resources since it creates an object on every invocation, so basically yeah -Template.bind()
will suffice. If no arguments are provided to bind nothing bad will happen.