Skip to content

Instantly share code, notes, and snippets.

@motionrus
Created February 17, 2019 10:53
Show Gist options
  • Save motionrus/64c889d4228b03206d7bfac6cb1c7fbe to your computer and use it in GitHub Desktop.
Save motionrus/64c889d4228b03206d7bfac6cb1c7fbe to your computer and use it in GitHub Desktop.
import { useState } from 'react'
export default () => {
const [openItemId, setOpenItemId] = useState(null)
const toggleOpenItem = (id) => () => (openItemId === id ? setOpenItemId(null) : setOpenItemId(id))
return { openItemId, toggleOpenItem }
}
@motionrus
Copy link
Author

motionrus commented Feb 17, 2019

в 5 строчке пофиксил

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment