Why {...arg} are passed inside the daisyUi component. All components have internal {...arg} . But what does it do.
return <Button {...args} />
Another one
<Dropdown {...args}>
<Dropdown.Toggle>Click</Dropdown.Toggle>
<Dropdown.Menu className="w-52">
<Dropdown.Item>Item 1</Dropdown.Item>
<Dropdown.Item>Item 2</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
return <Swap {...args} />
It's a frustration of mine too. Their docs just aren't very good. Basically
argsis an object of props, and{...args}can be used to unpack that object, as though they were props to the component.If we look at Dropdown, we could set the
hoveroption like:(More realistically probably from function props or something)
or like
Which to me is a lot more readable, but isn't as flexible if this is a part of a larger component or something.