-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Problem Description
I am using react-table 6.0.2, and using redux to hold a single state across my app.
I have a connected component which maps part of the state to props (most of the parameters I need to control the table), and passes those down to a component which only holds the react-table, and the functions that I have defined in order to work with it.
I have an onFetchData which seems to take as parameters the (target?) state and which allows me to query an api for new data.
For now I am only interested in pagination, so I expect that coming from the first page, when I call onFetchData from a click on the 'next' button, the target state will hold the second page (actually, page # 1 instead of 0), so that I can call my api action getData({ page: 1, pageSize: 5}).
Instead, the state passed in props to onFetchData contains page=0, so have basically no way of knowing what action to take.
By the way I have also tried something simiilar with changing page size, but the same behavior happens (no target pageSize) so I don't know how I can change the pageSize. The action does fire, but it takes as parameters the 'current' state, so obviously the result stays the same.
Am I doing something wrong here?
Steps to Reproduce
not sure if necessary to go all the way but:
- Set up actions/reducers to have a fetchData action change data in the redux store
- build a component which gets called by its container with all the right props from the state
- inside this component, have a ReactTable component with onFetchData that calls a function to trigger the fetchData action, or console.log(state) inside onFetchData
- try to change page