🌐
Medium
johnnie-agonz71.medium.com › react-useselector-usedispatch-9e72c7f25d7e
React useSelector & useDispatch. React has many features that are… | by Johnnie Gonzalez | Medium
February 21, 2021 - Now with “useSelector” in one line of code you can retrieve state, a callback function, which returns a specified state. In this case it is called “counter”. This allows us to get state and use it in this example to show the current counter. As for “useDispatch” this allows us to “dispatch” a certain action to our reducer.
🌐
hitesh mishra
hiteshmishra.hashnode.dev › useselector-hook-in-react
useSelector() Hook in React
April 29, 2023 - Learn how to use the useSelector() hook in React to access Redux store values with ease.
Discussions

React Hook "useSelector" used in common functions
The problem as you described is due to LogoutUser being a regular function. Hooks (as their name implies) hook into react component architecture. Regular functions don't have this, so they won't work. But this looks like you're trying to close an alert in response to the redux state changing. For that, you might want to consider responding to the action instead of reading data after the fact: https://redux.js.org/usage/side-effects-approaches More on reddit.com
🌐 r/reactjs
3
0
December 14, 2023
useSelector from Redux store
I have finally got my first Redux store working and I can access my user json no problem however I am unable to to access my fields json that is in the store. The fields data is in the store the same as user data however… More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
0
0
March 24, 2021
Redux: useSelector vs connect
Hooks are much easier to deal with type wise (imho) As well as can give you more functionality in a parent. Connect itself doesnt give you an on mount effect, however you can do that if you make a hook based connect. More on reddit.com
🌐 r/react
10
3
March 2, 2023
RTK: useSelector() vs store.getState()
Your coworker is wrong: Store subscriptions are not meaningfully expensive If a component depends on data from the Redux store, it should use useSelector to access that data, so that it re-renders if the data changes You should avoid directly importing the store into component files More on reddit.com
🌐 r/reactjs
13
2
August 2, 2023
🌐
React Redux
react-redux.js.org › hooks
Hooks | React Redux
February 11, 2026 - When an action is dispatched, useSelector() will do a reference comparison of the previous selector result value and the current result value. If they are different, the component will be forced to re-render. If they are the same, the component will not re-render.
🌐
DEV Community
dev.to › sarioglu › why-i-prefer-connect-over-useselector-using-redux-2jb9
Why I prefer "connect" over "useSelector" using redux? - DEV Community
May 24, 2021 - Only the data that is needed to be long-lived and globally available should make into Redux state. From this perspective, ease of use becomes our enemy. As React's useState hook and Redux's useSelector hook offer similar API surfaces, developers tend to put most of the state to their Redux state instead of picking only necessary ones.
🌐
Samdawson
samdawson.dev › article › react-redux-use-selector-vs-connect
useSelector vs connect (react-redux)
February 1, 2021 - React-redux hooks like useSelector() and the connect() can have the same outcomes. The main difference between them is their ability to nudge (guide) the way you write your components.
🌐
Medium
medium.com › @mendes.develop › introduction-on-react-redux-using-hooks-useselector-usedispatch-ef843f1c2561
Introduction on React-Redux using Hooks ( useSelector & useDispatch ) | by Alex Mendes | Medium
November 25, 2019 - Let’s start by importing useSelector from the react-redux library. useSelector is a function that takes the current state as an argument and returns whatever data you want from it.
🌐
DEV Community
dev.to › tsbrun › my-misadventures-with-the-useselector-hook-5gdl
My misadventures with the useSelector hook - DEV Community
June 3, 2022 - When it comes down to using data from the global state, it is best practice to write selector functions. The React-Redux library provides the useSelector hook, allowing you to use the selector function within a component.
Find elsewhere
🌐
Memberstack
memberstack.com › home › blog › product › using react redux hooks: useselector() and usedispatch()
Using React Redux Hooks: useSelector() and useDispatch() | Memberstack
June 3, 2022 - The significant difference between them is that mapStateToProps passes down multiple values as props, while useSelector takes the current state as an argument, returns the required data, and stores the returned value as a single variable instead of a prop.
🌐
TypeOfNaN
typeofnan.dev › how-to-use-the-useselector-redux-hook-with-typescript
How to use the useSelector Redux hook with Typescript | TypeOfNaN
May 17, 2021 - Redux offers the useSelector hook to get values from your store. Make sure you get the most out of it by typing it correctly.
🌐
DhiWise
dhiwise.com › post › useselector-how-to-access-redux-store-state-in-react
Accessing Redux Store State Made Easy with useSelector
April 22, 2024 - In the ecosystem of React Redux, useSelector is a hook that plays a pivotal role in allowing your React components to select data from the Redux store. It's a part of the React Redux hooks API, which has revolutionized the way developers connect ...
🌐
Medium
m-rowe42.medium.com › a-basic-understanding-of-useselector-aba865ed687e
A Basic Understanding of useSelector | by Mac Rowe | Medium
October 17, 2021 - According to the React-Redux docs, useSelector is the approximate equivalent to mapStateToProps argument to connect, and that it will be called with the entire Redux store state as its only argument.
🌐
Alma Better
almabetter.com › bytes › tutorials › reactjs › hooks-in-redux
React Redux Hooks: useSelector and useDispatch
October 18, 2023 - The useSelector hook is a feature provided by the React-Redux library that allows React components to access the state stored in a Redux store. It is a replacement for the traditional mapStateToProps function used in class-based components.
🌐
GitHub
github.com › reduxjs › react-redux › blob › master › src › hooks › useSelector.ts
react-redux/src/hooks/useSelector.ts at master · reduxjs/react-redux
export interface UseSelector<StateType = unknown> { /** * A function that takes a selector function as its first argument. * The selector function is responsible for selecting a part of · * the Redux store's state or computing derived ...
Author   reduxjs
🌐
Redux
redux.js.org › deriving data with selectors
Deriving Data with Selectors | Redux
January 22, 2026 - It's common to want to pass additional arguments to a selector function. However, useSelector always calls the provided selector function with one argument - the Redux root state.
🌐
egghead.io
egghead.io › lessons › react-access-state-with-the-redux-useselector-hook
Access State with the Redux useSelector Hook | egghead.io
Instructor: [0:00] Open up exchangerate.js and, in the top of the file, import { useSelector } from 'react-redux'. Then, comment out the first two useState lines. Type const amount = useSelector((state) => state.amount).
🌐
Scaler
scaler.com › home › topics › react › hooks in redux : useselector and usedispatch
Hooks in Redux useSelector and useDispatch - Scaler Topics
June 22, 2024 - The useSelector hooks allow you to extract data or the state from the Redux store using a selector function. It is equivalent to the mapStateToProps argument used in the connect() function conceptually.
🌐
Medium
dhrubot.medium.com › useselector-and-usedispatch-redux-cbd41cfa1a93
useSelector and useDispatch: Redux | by Dhrubo Dh | Medium
May 25, 2021 - useSelector on the other hand, will get the state from the redux store. Effectively replacing mapDispatchToProps, mapStateToProps, respectively.
🌐
Reddit
reddit.com › r/reactjs › react hook "useselector" used in common functions
r/reactjs on Reddit: React Hook "useSelector" used in common functions
December 14, 2023 -

This is my selectors.js
import { useSelector } from 'react-redux';
export const useCloseAlertTrigger = () => useSelector((state) => state.common.closeAlertTrigger || {});
this is my commonFunction.js [in this I am storing my all common functions ]
export const LogoutUser = async () => {
const closeAlert = useCloseAlertTrigger();
if (closeAlert) {
const result = await DisplayMessageOnClosebookingEdit();
if (result) {
return false;
}
}
const result = await RCM_API(
'POST',
'',
{
service: 'service',
action: 'logout',
},
true
);
if (result && result.resultCode === STATUS.SUCCESS) {
window.location.href = \${window.location.origin}/${BASE_PATH}/logout`;}return true;};`

in this functions I have used useCloseAlertTrigger hook but react throws an error that hook can be called inside functions it should called inside component only , and if I make simple functions rather than hook then another error arrives like useselctor can only be used inside component or react hook , that's why I have to give the prefix use
i want to make the redux architecture common like i will make selectors functions inside selector.js and i will use that selectors in commonfunction.js and from that i will use respective function in component PS: i am using **redux-toolkit **

🌐
freeCodeCamp
forum.freecodecamp.org › javascript
useSelector from Redux store
March 24, 2021 - I have finally got my first Redux store working and I can access my user json no problem however I am unable to to access my fields json that is in the store. The fields data is in the store the same as user data however when I go to use useSelector it returns undefined when I console.log.