How i can control sp-checkbox status using another sp-checkbox button? I need to make Cyan, Magenta, Yellow and Black checked automatically when I click on CMYK, please help me how to that using react?
For example, this is a component written with the following rules
If CMYK is checked, then Cyan/Magenta/Yellow/Black will all be checked
If CMYK is not checked, then the check status of each color is used
Spot will have a state regardless of CMYK
This is probably not the rule you intend, but look at it as an example of how to write a condition. And this is written in Preact, but it should work if you replace the import statement and Fragment for React.
Thank you for answering, you really helped me.
I removed fragment and code works, but it’s not toggle off and on when clicking again.
I make some changes and it works now, I believe that my code must be much cleaner, but it is enough for my needs
You shouldn’t use JS to manipulate DOM in React. Use state instead - much cleaner and more simpler when you get it. That whole JS block with loops would be gone