You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two check boxes. I want to set defaultChecked value to values coming from ipcMain (saved user preference) but even the state is true, it's always in unchecked position. Checked the state in render function, it logs true but I can't set them.
I am reading from the default values saved in json (with electron-settings package) There are two of them one is true one is false. No matter what I tried Checkboxes always false.
I have no experience in react, so if it is a silly mistake, I'm sorry:)
Yeah,
I see that defaultChecked is passed in as a prop, but then it is read into checked in the Checkbox state.
So that value is really just for initialization.
@gabrielbull , to resolve this, what if we created a CheckBoxBase component. This component would be a styled-component with the current UI/styling as CheckBox, but having all the logic moved to props, so that the user can extent the CheckBox as they see fit.
In this case, the user could have used the CheckBoxBase component, and passed the parent state values ( isCheckedTerminal, isCheckedHistory), as props so that the values are bound to the parent state, instead of the child state. The parent state can then be updated , and those values would then trigger the desired logic.
There are two check boxes. I want to set defaultChecked value to values coming from ipcMain (saved user preference) but even the state is true, it's always in unchecked position. Checked the state in render function, it logs true but I can't set them.
I am reading from the default values saved in json (with electron-settings package) There are two of them one is true one is false. No matter what I tried Checkboxes always false.
I have no experience in react, so if it is a silly mistake, I'm sorry:)
Here is my code:
Also full github repository is here:
(https://github.com/hullabaloon/react-desktop-checkbox)
The text was updated successfully, but these errors were encountered: