How to maintain state in react native
Basically, I have a list of products, in this list, I have a favorite function, but when I am logged out and favorite a product, it returns me to the login screen. After logging in, I have to do the…
Basically, I have a list of products, in this list, I have a favorite function, but when I am logged out and favorite a product, it returns me to the login screen. After logging in, I have to do the…
so, I developed an application with RN and Redux, I have a colors.js file like that const Colors = { mainColorDark: '#E34b3d', mainColor: '#e3596d', mainColorLight: '#F0965C', } export default Colors; The client has requested to add another type of user…
Below is the CreateCoursePage component where I use react-redux to manage the state after some database operations. However dispatch(CreateCourse(course) statement inside mapDispatchToProps throws this exception: TS2345 (TS) Argument of type '(dispatch: Dispatch) => void' is not assignable to parameter of…
How to save a function instead of a value in RTK so that i can save a function reference in a component and call it in another component in React? I just want to reset timer from another component. I…
When I check state in redux dev tools, I see reducers: undefined. I don't know what is wrong with this code. postsSlice.js import { createSlice } from '@reduxjs/toolkit' const postsSlice = createSlice({ initialState: [{ id: '1', title: 'test', desc: 'test2'…
I have a hook that I use in my components to access an external resource that is fetched through Ajax and saved in the Redux store. What I want is for this hook to handle fetching the resource if it's…
```import { useState } from 'react'; export default function FeedbackForm() { const [name, setName] = useState(''); async function handleClick() { setName(prompt('What is your name?')); await alert(`Hello, ${name}!`); } return ( <button onClick={handleClick}> Greet </button> ); }``` I'am trying to get…
how to validate login email & password using redux? a already make a handleLogin function it work fine when user input the right email&password but if user submit the wrong email&password the api crash const handleClick = (e) => {…
I built a MERN project, where the component FrindListWidget is being called on 2 conditions. If it's the user's own friendlist, the widget will be rendered as well as a state in Redux user.friends will also update. If it…
The below code for an asynchronous action works does not work, i.e, the fetch works fine but the dispatch doesn't work. (Please see the output in the codesandbox link at the bottom.) function addUser(user) { return { type: FETCH, payload:…