×I get :× TypeError: Cannot read properties of null (reading 'useReducer')

Viewed 18

I get the "× TypeError: Cannot read properties of null (reading 'useReducer')" when I use the following code:

import React, { useReducer,useContext, useEffect  } from 'react';


 const [{ loading, error, order, successPay, loadingPay }, dispatch] =
        useReducer(reducer, {
            loading: true,
            order: {},
            error: '',
            successPay: false,
            loadingPay: false,
        });
0 Answers
Related