Do we still need a redux?
I think, we can manage state of application with Hooks API and Context API of React.
const GlobalContext = createContext(defaultValue)
export const GlobalProvider = ({ children }: { children: React.ReactNode }) => {
const [state, dispatch] = useReducer(reducer, globalState)
const value = useMemo(() => [state, dispatch], [state])
return <GlobalContext.Provider value={value}>{children}</GlobalContext.Provider>
}
π‘ If you don't like TypeScript, you can see the VanillaJS version
src
βββ api
βββ components
βββ containers
βββ modules
βββ routes
βββ utils
βββ App.tsx
βββ index.tsx
Project by @Jbeeβ