[Bug] Can't click radio button if using setState inside handleOnSelect
See original GitHub issueHi, I have this options
const selectRow = {
mode: "radio",
clickToSelect: true,
onSelect: this.handleOnSelect
};
handleOnSelect = (row) => {
//if using setState the radio button options will not show up, if remove setState everything ok
this.setState({
selectedId: row.userId
});
};
Below is error
Issue Analytics
- State:
- Created 5 years ago
- Comments:35 (12 by maintainers)
Top Results From Across the Web
RadioButton click TypeError: Cannot read property 'setState' of ...
In order to use this keyword, you need to bind the method. Or as a workaround you can use the arrow function ....
Read more >How to Use Radio Buttons in ReactJS | Pluralsight
In this guide, you'll learn the basics of the radio button, how to use it in a group, and how to access the...
Read more >React Radio Group component - Material UI - MUI
The Radio Group allows the user to select one option from a set. Use radio buttons when the user needs to see all...
Read more >react-native-simple-radio-button - npm
simple and useful animated radio button component for React Native. Latest version: 2.7.4, last published: 3 years ago. Start using ...
Read more >Radio class - material library - Flutter - Dart API docs
When one radio button in a group is selected, the other radio buttons in the group ... radio button is pressed, the example's...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For those looking for a solution to the radio/checkbox toggle disabling when calling setState:
What works for me is setting the
selected
property in theselectRow
object you pass to the table.selected: [this.state.selectedUserId],
as mentioned by @AllenFang (16 April comment above)I understand the legacy
react-bootstrap-table
allow you to callsetState
without manage/control the selection byselectRow.selected
. So it can be improved inreact-bootstrap-table2
, but with much lower priority