Redux Hooks
useDispatch
// outside Component Function
const mapDispatchToProps = dispatch => {
return {
addIngredient: (ingName) => dispatch(actions.addIngredient(ingName)),
}
}
replace by
// inside Component Function
const addIngredient = (ingName) => dispatch(actions.addIngredient(ingName));
useSelector
// outside Component Function
const mapStateToProps = state => {
return {
price: state.burgerBuilder.price
}
}
replace by
// inside Component Function
const price = useSelector(state => state.burgerBuilder.price);