Redux

Redux notes

1st step is to create store using this markup.

import { createStore } from 'redux'

const store = createStore(()=>{});

so 2ndt step is to import all these modules in react like:

Important part of Redux.
createContext, useReducer, useEffect and useConext.

import React, { createContext, useReducer, useEffect, useContext} from "react"

for using createContext you need to create initial state: example below:

const initialState = {
 userId:nanoid(),
 posts:[],
 isLoading:true,
 isError:false,
};
export const AppContext = createContext(initialState);

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *