| Ugh, this is massively overcomplicating the vanilla js case. Just put the checkbox html & css on the page. Write a function that updates the label based on checked state. Call it on input/change events. It's like 3 lines of js. React.js people always invent this vanilla js / jQuery strawman that's so complicated and spaghetti that no mortal can possibly understand it. It's total BS. You can write succinct maintainable code without a 100 lb framework. |
The vanilla code was much easier to maintain too. React comes in your way when things get complicated and the work arounds produce really messy code.
Edit:
Project (GitHub): https://github.com/labmlai/labml/tree/master/app
It's a mobile/web app to monitor machine learning experiment.