I’m learning React/Redux and need someone to take a look at my mini-demo at https://stackblitz.com/edit/react-iabk8k and advise what I’m doing wrong …
Note that example does not load data from external API (CORS issue maybe - even though I have Access-Control-Allow-Origin: * ) - and somehow all I’m getting is TypeError while trying to fetch data… but that’s not the main problem. This part works locally so I did not focus on fixing it for demo. However, if you can suggest how to modify code to get real error logged it would be great
When I click on page number 2 or on the ‘next’ arrow - console.log shows that I’m requesting page 1 - even though I’d expect to see 2. Clicking on ‘last’ correctly requests page 10 and clicking on ‘first’ call page 1.
Can you please advise what’s happening? I suspect it’s a conflict between Redux setting the state and onPage handler also setting the state … but I’m at loss how to fix it
Or … maybe whole my chain is wrong? With all those actions/connect etc? I followed examples from some React/Redux books …
Any help will be highly appreciated!
P.S. Running this code locally with valid API responses causes infinite loop of calls to first page… I guess it’s because of code in componentDidMount() … I’d expect it to be a right place to load first page of the table