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

215
Views
el estado no está definido en useSelector en react native redux

He estado tratando de aprender redux durante días pero no puedo aprenderlo. el estado no está definido en useSelector en react native redux, pero esto siempre sucede cuando uso UseSelector, el estado no está definido, por favor ayuda. Este es mi mi código en su forma más simple.

 import React from 'react'; import {Provider} from 'react-redux'; import Home from './screens/home'; const App = () => { return ( <Provider store={Store}> <Home /> </Provider> ); }; //store import {createStore} from 'redux'; export const Store = createStore(reducer); //reducer const initialState = { name: 'John', }; function reducer(state = initialState, action) { return state; } //action export const setName = () => { return { type: SET_USER_NAME, }; }; export default App;
 import {StyleSheet, Text, View} from 'react-native'; import {useSelector} from 'react-redux'; const Home = () => { const state = useSelector(state => state); alert(state); return ( <View style={styles.container}> <Text>Hello</Text> </View> ); }; const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', }, }); export default Home;
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Está utilizando la tienda antes de que se inicialice. Muevete

 const App = () => { return ( <Provider store={Store}> <Home /> </Provider> ); };

en la parte inferior antes export default App; entonces funciona

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!