Open yoavaa opened 2 years ago
AutoItems props are defined as
export type AutoItemsProps = { render?( item: React.ReactNode, props: AutoViewProps, index: number ): React.ReactNode; } & AutoViewProps;
which forces to provide render as a prop in JSX, as
render
<AutoItems {...props} render={ (node) => <li>node</li> }> </AutoItems>
I suggest to change the interface a bit, renaming render to children, so that
children
export interface AutoItemsProps extends AutoViewProps { render?( item: React.ReactNode, props: AutoViewProps, index: number ): React.ReactNode; }
which allows
<AutoItems {...props}> {(node) => <li>node</li>} </AutoItems>
and still allows using
<AutoItems {...props}/>
Basically, using a property named children allows to place the function as a child in the JSX
No response
Same issue for AutoFields
AutoFields
Is there an existing issue for this?
The problem
AutoItems props are defined as
which forces to provide
render
as a prop in JSX, asDescribe the solution you'd like
I suggest to change the interface a bit, renaming
render
tochildren
, so thatwhich allows
and still allows using
Basically, using a property named children allows to place the function as a child in the JSX
Describe alternatives you've considered
No response