Created
February 17, 2019 10:53
-
-
Save motionrus/64c889d4228b03206d7bfac6cb1c7fbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react' | |
export default () => { | |
const [openItemId, setOpenItemId] = useState(null) | |
const toggleOpenItem = (id) => () => (openItemId === id ? setOpenItemId(null) : setOpenItemId(id)) | |
return { openItemId, toggleOpenItem } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
в 5 строчке пофиксил