You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to create separate components with CollapseHeader and CollapsedBody, without the need to do dirty props, I think hooks improve the experience and would make the code cleaner.
example without hook:
// parent component should have a useState to dirty propsfunctionHeader({ title, isExpanded }: Props){return(<CollapseHeader><TitleHeader><Title>{title}</Title><Feathername={isExpanded ? 'chevron-down' : 'chevron-up'}size={15}color='#fff'/></TitleHeader></CollapseHeader>);}functionExample(){const[isExpanded,setExpanded]=React.useState(true);return(<CollapseisExpanded={isExpanded}onToggle={()=>setExpanded(!isExpanded)}><Headertitle="Hello"isExpanded={isExpanded}/>{/* ... */}</Collapse>);}
I would like to create separate components with CollapseHeader and CollapsedBody, without the need to do dirty props, I think hooks improve the experience and would make the code cleaner.
example without hook:
example with hook:
The text was updated successfully, but these errors were encountered: