Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
El reductor no es una función. reaccionar nativo redux

Estoy tratando de agregar un reductor a mi aplicación nativa de reacción. Aquí está la constante de la tienda:

 export const USER_PROFILE = 'USER_PROFILE';

Aquí está la acción.js

 import {USER_PROFILE} from '../constants/index'; export function userProfile(userReducer) { return { type: USER_PROFILE, payload: { email: '', }, }; }

Este es el userReducer que está causando el error. Sigo recibiendo un error de customerReducer no es una función.

 import {USER_PROFILE} from '../constants/index'; const initialState = { userProfile: '', }; const customerReducer = (state = initialState, action) => { switch (action.type) { case USER_PROFILE: return { ...state, userProfile: action.payload, }; default: return state; } }; export default customerReducer;

Y he declarado el correo electrónico como estado... const [email, setEmail] useState('')

llamando al reductor aquí. const customerReducer = useSelector(state => state.userProfile); Ahora enviándolo con el método useDispatch.

 const dispatch = useDispatch(); ... dispatch(customerReducer(email));
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Tu action.js debería verse así:

 import {USER_PROFILE} from '../constants/index'; export function userProfile(userReducer) { return { type: USER_PROFILE, payload: { email: userReducer.email, }, };

y cuando envíe, debe usar la acción "perfil de usuario" y no el reductor "reductor de cliente". Su envío debería verse así:

 dispatch(userProfile({email}));

asegúrese de usar corchetes. porque debes pasar un objeto, no una cadena.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!