question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Can't click radio button if using setState inside handleOnSelect

See original GitHub issue

Hi, 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

2018-04-08_17-50-12

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:35 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
abdhasscommented, Jul 24, 2018

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 the selectRow object you pass to the table. selected: [this.state.selectedUserId], as mentioned by @AllenFang (16 April comment above)

2reactions
AllenFangcommented, May 16, 2018

I understand the legacy react-bootstrap-table allow you to call setState without manage/control the selection by selectRow.selected. So it can be improved in react-bootstrap-table2, but with much lower priority

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found