Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

204
Visualizações
React-Native: Property 'clientsReducer' does not exist on type 'DefaultRootState'.ts(2339)

Having issues when trying to implement useSelector(). It is giving me the error:

"Property 'clientsReducer' does not exist on type 'DefaultRootState'.ts(2339)"

Usually, I've done mapStatetoProps so first time trying it this way. I've watched a few tutorials and they all seem to set it up the same way I am without issue.

ClientsScreen.js

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

store.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;

reducers/clients.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;

reducers/index.js

import { combineReducers } from 'redux';
import auth from './auth';
import clientsReducer from './clients'

const rootReducer = combineReducers({
    clientsReducer
});

export default rootReducer;

App.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>    
  );
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda