Created
March 27, 2020 20:57
-
-
Save mattbajorek/f532a1ca095b970d19dc9d94ddb99285 to your computer and use it in GitHub Desktop.
todos-redux-to-react-sweet-state filter link container
This file contains hidden or 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 React from 'react' | |
import Link from '../components/Link' | |
import visibilityFilterSelectors from '../stores/visibilityFilter/visibilityFilter.selectors' | |
const FilterLink = ({ children, filter }) => { | |
const [visibilityFilter, { setVisibilityFilter }] = visibilityFilterSelectors.useVisibilityFilter() | |
return ( | |
<Link | |
active={filter === visibilityFilter} | |
onClick={() => setVisibilityFilter(filter)}> | |
{children} | |
</Link> | |
) | |
} | |
export default FilterLink |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment