I want to click a button to show a popup without using state and without using hooks. I am currently using 'antd' as my graphics library but any solution that works can be adapted for my needs.
The button comes from a return of a function:
public getButton()
{
return <Button onClick={()=>???} >Yes</Button>
}
The onClick should generate a Modal (ideally).
Thanks.
In React, state
basically describes the current visual representation of the app. and I think the scenario you described is one of the classic use case of state, why you want to go against it?
FYI,
Drop React. JQuery's .append
is what you are looking for.
Instead of storing it in a state, use this
variable like this.showModal
to store the boolean value and use it for showing modal.
I want to click a button to show a popup without using state and without using hooks. I am currently using 'antd' as my graphics library but any solution that works can be adapted for my needs.
The button comes from a return of a function:
public getButton()
{
return <Button onClick={()=>???} >Yes</Button>
}
The onClick should generate a Modal (ideally).
Thanks.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.