Table Action button onClick didn't print updated state
BalaRajendran opened this issue · 0 comments
Question
I'm using the Functional component, I had added a button in my table. With a click of the action button, I have to print the updated value from the state. I tried this use case with both Functional and Class Component, it was working fine with Class Component, not working with Functional Component, state is printing old values
codesandbox
Attaching both functional and Class component examples.
Functional component => https://codesandbox.io/s/react-bootstrap-table-next-add-button-to-cell-forked-1ue2ft?file=/src/index.js
Class component => https://codesandbox.io/s/react-bootstrap-table-next-add-button-to-cell-forked-t9npoz?file=/src/index.js:1865-1889
In this example I have placed a button Update random values and one state called values. And a table with a couple of rows with follow button
Steps to reproduce
- First take the class component, Press the
Update random valuesbutton, it will update the state - You can clearly watch the updated state below the table
- Now press the
Followbutton from any row, With the Click of a button it will print the state, If you check the console logs, it will print the updated value - But when you tried that in Functional Component, it didn't print the latest value
Screenshots
Took a screenshot from Class component

Same took a screenshot from the Functional component

Problem Statement
After clicking of follow button, it should print the updated values from the State. Like a class component
Thanks in Advance