score:0
export const makestore = (context: context) => {
const sagamiddleware = createsagamiddleware();
const store = createstore(
rootreducer,
// list of your middlewares here
bindmiddleware([thunk, sagamiddleware])
);
// in case someone else uses saga
(store as sagastore).sagatask = sagamiddleware.run(rootsaga);
return store;
};
your rootreducer:
const rootreducer = combinereducers({
productlist: productlistreducer,
cart: cartreducer,
user: userloginreducer,
userdetail: userdetailreducer,
});
and your rootstate
export type rootstate = returntype<typeof rootreducer>;
score:1
my understanding of redux
is that the store is the data object. so it's entirely defined by you.
interface storetype {
label: string;
}
suppose the above is your data structure
Source: stackoverflow.com
Related Query
- The best proper type for store in Next.js project + TypeScript
- Typescript and React: What is the proper type for an event handler that uses destructuring?
- What is the proper typescript type for creating element
- What is the react-app-env.d.ts in a react typescript project for
- Proper TypeScript type for creating JSX element from string
- What is the best way to create a single MobX store for an app?
- what is the correct type for a React instance of a component in typescript
- How do you set the Typescript type for useRef hook in React Native?
- Structuring react project with flow type for best type reusability
- What is the correct typescript type for react children?
- TypeScript utility type for conditional props (based on entered value of other properties in the type)
- I can't find the matching TypeScript type for `displayName` as a prop of `type`
- Typescript - Setting the type for a null property, when defining the initial state in Redux
- How to make Typescript recognize the type for an Apollo Query
- What Typescript type to set for setState passed to the component
- How to set the correct typescript type for setValue in react-hook-form?
- What is the best implementation for accessing single Redux's store in deeper container component?
- Typescript throwing an error for the wrong type even when the type is right
- Is is possible to use an typescript Union type for the state of a Redux Toolkit Slice?
- What's the correct return type for a TypeScript HOC being used as a decorator?
- Which is the best practise for using axios in React Project
- How to get the value of redux store in other components on typescript react hooks project
- What's the proper way of giving react stateless functional component a typescript type
- What is the Typescript type for a route map object in hookrouter?
- Generic TypeScript Type for functions returning functions that replaces the ReturnType with the ReturnType of the returned function
- What's the best way to store a global variable for a reusable React component?
- Typescript inference for unions not picking up the correct type
- What is the best way to access redux store outside a react component?
- Typescript react - Could not find a declaration file for module ''react-materialize'. 'path/to/module-name.js' implicitly has an any type
- What is the difference between .ts and .tsx extensions. Both are used as extensions for typescript files in react. So where should we use them?
More Query from same tag
- How to access and use the data in JSON coming from google spreadsheet?
- IOS automatically zooms in when i set font size below 16px on iPhone
- Delete dynamically added table row - react js
- React Higher Order Component Initial Props
- ReactJS onClick event inside map function, then call parent's function
- How do I rerender a functional component?
- React form not displaying the correct inputs on the screen after I click submit button
- Get nested data from Firestore Database in REACT JS
- Getting Error "parsererror" "Error: jQuery21106393266040831804_1456914722748 was not called" On Ajax Call Reactjs
- React-Router v6 confusion
- ReferenceError: localStorage is not defined in ReactJS Build
- debounce or throttle user input onKeyUp for a dropdown filter
- Type error on React Route component
- Adding an .env file to React Project not working
- Cannot read property 'sort' of undefined in reactjs
- Styling an input field: adding custom buttons inside
- React.js: Updating an Array of Objects stored in state
- Install webpack offline
- React/CSS - Animate button width resize after content changes when width is auto
- Why does my react app keep crashing on Heroku?
- React different ways of calling a child method
- Multiple videojs players in the same react component
- How do I execute function after loading all external library with React Hook useEffect?
- How to get current post id in Gutenberg custom block?
- React Redux TypeError this.props.setEmailText is not a function
- TDD / BDD with React.js?
- React-Redux application created by Visual Studio 2017 gives compile errors in Visual Studio Code
- React/Typescript error when adding promise to a function?
- edit exercise component not being displayed
- TypeScript Error 2304: Cannot find name 'div' - CRA TypeScript Template