TypeError: Cannot destructure property 'reintroduceHouseStatus' of '(0 , _reactRedux.useSelector)(...)' as it is undefined.
As you see in the above screenshot, the only thing I've failed is passing yarn test.
import axios from 'axios';
import React, { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { History } from 'history';
import Modal from 'react-modal';
import { House, User } from '../../api';
import { HouseCreateForm, HouseInviteModal, HouseManageModal } from '../../components';
import { houseStatus } from '../../constants/constants';
import { userActions } from '../../store/actions/index';
import { OrangeGlobalState } from '../../store/state';
interface Props {
history: History;
house: House;
me: User;
}
function HousePage(props: Props) {
const [houses, setHouses] = useState<[House]>();
const [houseToBeInvited, setHouseToBeInvited] = useState<House>();
const { getMeStatus, me } = useSelector((state: OrangeGlobalState) => state.user);
const { reintroduceHouseStatus, renameHouseStatus } = useSelector((
state: OrangeGlobalState,
) => state.house);
When I try the below codes
console.log('reintroduceHouseStatus : ', reintroduceHouseStatus);
console.log('renameHouseStatus : ', renameHouseStatus);
console returns two status when I execute the functions relating to the status.
I don't know why getMeStatus has no problem but reintrudoceHouseStatus and renameHouseStatus have. (already checked state: OrangeGlobalState to which two status referred. Is there any problem with the version of reactRedux?
I'm curious if anyone had had the same problem as me.
Thanks.
The below codes are from src/App.test.tsx
import React from 'react';
import { render } from '@testing-library/react';
import { Provider } from 'react-redux';
import App from './App';
import { getMockStore, history } from './tests/mocks';
const mockStore = getMockStore({
user: {
me: {},
},
necessity: {
necessities: [],
},
});
test('renders app with mock store', () => {
const app = render(
<Provider store={mockStore}>
<App history={history} />
</Provider>,
);
expect(app.container.firstChild).toHaveClass('App');
});

