Hello I am using a selector multiple times in my Application. Can I write the code once and import then the selector? I thought to write a custom hook but I think this it is not necessary. Here is my Selector:
const county = useSelector((state)=>{
const id = state.user.id
const name = state.user.name
return state.users.filter((user) => user.name === name)[0].county
})
It would nice if I have something like this:
import {countySelector} from 'selectors'
const county = useSelector(countySelector)