Hi I'm new to React and am trying to get the useSelector in a class component which isn't working. Any help would be greatly appreciated.
The useSelector looks like this:
const userLogin = useSelector(state => state.userLogin);
const {userInfo} = userLogin;
And I'm trying to pass it in this:
export class StatusReport extends Component{
constructor(props) {
super(props);
this.state = {
// Active Work Orders clients
AWOS: [],
clientIsLoading: true,
}
}
componentDidMount() {
axios.get(process.env.REACT_APP_API+'status_reports/',{
headers:{
"Accept":'application/json',
"Content-Type":'application/json'
},
})
.then(response=>{
this.setState({AWOS: response.data});
this.setState({clientIsLoading: false});
})
}
render() {
const {clientIsLoading} = this.state;
if (clientIsLoading){
return <div className={'loadingSpinner'} >Loading...<br/> <ClockLoader color="#0d00ff" /></div>
}
return (
I've tried diffrent ways of passing in the state