Skip to content

Instantly share code, notes, and snippets.

@DZuz14
Last active July 17, 2020 19:46
Show Gist options
  • Save DZuz14/f65dd0c93c8f8d9d8aaf5d48cd055007 to your computer and use it in GitHub Desktop.
Save DZuz14/f65dd0c93c8f8d9d8aaf5d48cd055007 to your computer and use it in GitHub Desktop.
Accordion with React Children Scaffold
const Accordion = ({ children }) => {
// const [open, setOpen] = useState('')
// const handleOpen = (e) => {
// const id = e.target.getAttribute('data-id')
// id === open ? setOpen('') : setOpen(id)
// }
return (
<div>
{React.Children.map(children, child => {
return <div></div>
})}
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment