• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

149
Vistas
React-Native: la propiedad 'clientsReducer' no existe en el tipo 'DefaultRootState'.ts(2339)

Tener problemas al intentar implementar useSelector(). Me esta dando el error:

"La propiedad 'clientsReducer' no existe en el tipo 'DefaultRootState'.ts(2339)"

Por lo general, he hecho mapStatoProps, así que es la primera vez que lo intento de esta manera. He visto algunos tutoriales y todos parecen configurarlo de la misma manera que yo sin problemas.

ClientsScreen.js

 export default function ClientsScreen ({navigation}){ const {clients} = useSelector(state => state.clientsReducer) const dispatch = useDispatch() const fetchClients = () => dispatch(getClients()); useEffect(() => { fetchClients(); }, []);

tienda.js

 import { createStore, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; import rootReducer from './reducers/index.js'; const initialState = {}; const middleware = [thunk]; const store = createStore( rootReducer, initialState, applyMiddleware(...middleware) ); export default store;

reductores/clientes.js

 import { GET_CLIENTS } from "../actions/types"; const initialState = { clients: [] } function clientsReducer(state = initialState, action){ switch(action.type){ case GET_CLIENTS: return{ ...state, clients: action.payload, }; default: return state; } } export default clientsReducer;

reductores/index.js

 import { combineReducers } from 'redux'; import auth from './auth'; import clientsReducer from './clients' const rootReducer = combineReducers({ clientsReducer }); export default rootReducer;

Aplicación.js

 export default function App() { return ( <Provider store={store}> <NavigationContainer> <Drawer.Navigator drawerContent={props => <DrawerContent {...props} />} screenOptions={{ headerStyle:{ backgroundColor: '#fff', }, headerTintColor: 'black', headerTitleAlign: 'right', headerTitle: () => ( <Image style={{width: 100, height: 25}} source={require('./assets/logo.png')} /> ), }} > <Drawer.Screen name="Main" component={MainTabScreen}/> {/* <Drawer.Screen name="Details" component={DetailsScreen} /> */} </Drawer.Navigator> </NavigationContainer> </Provider> ); }
almost 3 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda