Questions tagged [Redux] (663)

1
answer

How to copy state Redux in state of the component with hooks?

I need to do a live search. To do this, I get a list of posts from Stora Redux const posts = useSelector(state => state.posts); Create a filtered list in state component const [state setState] = useState({ postsFiltered: [] }) Make a request to the backend to Redux appeared posts and when they appear (2) state of t...
Alex_Bergna asked April 19th 20 at 12:42
0
answer

How to typecast the return value of the Thunk of action?

Hi. The situation is this: 1) There is an asynchronous action type AppThunk<ReturnType = void> = ThunkAction< ReturnType, RootState, unknown, Action<string> > export const registerUserAsync = (form: RegisterFormType): AppThunk<Promise<RegisterFormType>> => { return dispatch => new Pr...
Federico44 asked April 19th 20 at 12:38
1
answer

Ideologically what you can do in the thunk?

Is it possible to have thunk', after sending the request, add some complex (but not very) the logic of processing the data (using data from the state by calling getState), and based on the result of processing to do different dispatch'and?
cleveland asked April 19th 20 at 12:32
0
answer

How to describe the server API (Rest) at the front React/Redux using Typescript?

How to describe the server API on the front React/Redux using Typescript? maybe there are some practice of how to do it thank you
Nels_Bednar64 asked April 19th 20 at 12:31
1
answer

How to do authentication with React&amp;Redux?

Trying to make a registration and login with React&Redux. Use LocalStorage. But I don't know how to make the user's personal page where he can add to-do list.And that each user had their own list. Whether it is possible somehow to implement without the help of API and Fetch and the server? For example using React Router...
Jaden asked April 19th 20 at 12:22
1
answer

Using redux-thunk returned by a function is in action. How to fix it?

export const changeSearchValue = (value: string): Function => { return (dispatch: Function): void => { dispatch({ type: CHANGE, payload: value }); Axios.get("https://www.balldontlie.io/api/v1/players", { params: { per_page: 5, search: value } }) .then(function (response: any): void { dispatch({ type: SET_SUGG...
flavio.Gutma asked April 19th 20 at 12:22
1
answer

In action get access to the state redux?

When I do the dispatch using a function in which I need access to global State. Initially used circuit and method getState: export function addToPreList(name, count){ return (dispatch, getState) => { } } but in this case I for some reason was not updated props of the component that received the properties b...
Carolanne_Breitenbe asked April 19th 20 at 12:18
0
answer

Can I return a new object in createSelector?

There are the usual selector: const selectUserData = state => state.user.data; How can I get a part data of all object, I made it through createSelector: export const selectUserSomeData = createSelector(selectUserData, userData => { return { id: userData.id name: userData.name email: userData.email } }) Don't...
lavinia_Sanford83 asked April 19th 20 at 12:17
1
answer

What Redux analogue mapStateToProps and matchDispatchToProps when React application to add Redux-a functional component and hook useState?

I have the app on React and the file of my component functional and there use the hook useState. But you need to the app to add Redux. I heard that Redux for such cases(when there is a class component and there are hooks) there are analogues mapStateToProps and matchDispatchToProps, but I can't remember their names. As thei...
Lorna asked April 19th 20 at 12:07
2
answers

React: organization of state management?

There is a folder store, there are global reduceri, selectors, actions, constants. Fails to correctly organize all of this. I wish I was a global state, and it was different nested properties, for example theme: state = { theme: 'light' } Using selectors, I want to get a specific property from the state, for example: co...
anita_Denesik99 asked April 18th 20 at 13:14