I’m in this scenario
export class Test extends React.Component {
constructor(props) {
super(props);
this.state = {
disable: true,
};
}
column = [...someData];
actionButton = (
<React.Fragment>
<Button
disable={this.state.disable}
size="md"
style={{ margin: "2px" }}
id="a4156"
color="primary"
>
<FontAwesomeIcon icon={faSync} />
</Button>
</React.Fragment>
);
activateFlag = () => {
this.setState({ disable: false });
};
render() {
return (
<React.Fragment>
<Input type="checkbox" onClick={this.activateFlag} />
<Table
tableId="IO937493"
actionButtons={this.actionButton}
column={this.column }
exportable={this.state.disable}
/>
</React.Fragment>
);
}
}
any time that my component is rendered upload the actionButton with some preconfigured JSX…my question is…even that inside the variable is declared property “disable”, how can i change the state with the method that fired the onClick event? for the moment i’ve a flag that when i’m clicking fire this method…but withnotstanding the method change the internal state of the component this seems to have not effect on the disabling property…how can i risolve it?