node.js – Cannot destructure property react.js useSelector

I have an error
Cnnot destructure property ‘status’ of ‘(0 , react_redux__WEBPACK_IMPORTED_MODULE_1__.useSelector)(…)’ as it is undefined.

I’m trying to handle errors that come from the server with “toast”
But when I wrote this code in RegisterPage.jsx, the page doesn’t even open for me.

RegisterPage.jsx

const { status } = useSelector(state => state.auth )

    useEffect(() => {
        if (status) {
            toast(status)
        }
    }, [status])

store.js

export const store = configureStore({
    reducer:{
        auth: authSlice
    },
})

authSlice.js

const initialState = {
    user: null,
    token: null,
    isLoading: false,
    status: null,
}

Read more here: Source link