I'm wondering about others approach to Redux useSelector hook. For example in my code:
const selectedStage = useSelector(state => state.basket.stage);
IntelliJ/WebStorm are giving me warning Unresolved variable basket
I see two options: turning off this warning or use destructuring like:
const { basket: { stage: selectedStage} } = useSelector(state => state);
I think it is much less readable. Is there anything I miss or could be done better?
------- EDIT ---------
If I simplify my Redux setup to basic like:
const basketReducer = (state = initialState.basket, action) => {
switch (action.type) {
case CHANGE_BASKET_SETTINGS:
return { ...state, ...action.payload };
...
export default combineReducers({
basket: basketReducer,
...
import allReducers from "../reducers";
export const store = createStore(allReducers);
I get same warning. It's really annoying.