I need to get the id of a user from the store to my action is there a way how to make it correct because this is the way how I using it but I think it's not correct is there a better way how to make this.
this is my action
export const editNote = (note, userId)=> {
return async dispatch => {
await axios.put(`http://localhost:8080/api/user/${userId}/note`, note
)
.then(response => {
console.log("response from note api", response.body)
})
.catch(e => console.log(e))
}
}
and this is how I called id
const reducer = useSelector(state => state.user);
const onSubmit = values => {
console.log(values)
dispatch(editNote(values, reducer.id))
}