React userSelector gives undefined value for the first time

Im fetching data from api using axios, in the api https:/...?vs_currency=${currency}&... I am trying to assign currency value to api using redux. The problem is useSelector gives the undefined value for the first time and i failed to fetch data from this api. But then useSelector works fine. Error display is https:/...?vs_currency=undefined&...

React – undefined props error when rendering functional component

Sorry for the repetitive question. I have searched everywhere imaginable and I can’t figure this out. I’m new to React and I’ve noticed that there are several ways to go about every problem. My current issue is that I’m trying to convert a working class component to a function. The webpage was rendering just fine with the database content until I attempted to change the class to a function. Can anyone assist with isolating where the disconnect is? I’m sure there are several parts of the code that I did not transfer over to a function format.

page redirect problem in react, react-router-dom

import React, { useState } from "react"; import { Link } from "react-router-dom"; import { useDispatch, useSelector } from "react-redux"; import Message from "../../components/Message/Message"; import Loader from "../../components/Loader/Loader"; import { login } from "../../actions/userActions"; export default function Login({ history }) { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const dispatch = useDispatch(); … Read more

Action is called but didn’t executed in redux

I was trying to build login application. Its working fine but on refresh all the states are lost. When I log in the application [ from login page ] a token is received from backend, i store that token locally and calls the action “loadUser” which ultimately gets the user info and stores it. I was planning to use same action whenever my page is reloaded. Since my Navbar page is common to all the pages so i created was using useEffect hook to call loadUser action from there itself.