The value of pickedTrue changes from false to true as the component is mounting. but the input defaultChecked doesn't update it just sets as false.
page.js:
function page() {
return (
<Checkbox checked={'1'} />
)
}
export default page
checkbox component:
function Checkbox({checked}) {
const pickedTrue = checked == '1' ? true : false
console.log(pickedTrue)
return (
<input type="checkbox" defaultChecked={pickedTrue}/>
)
}
export default Checkbox
console.log(pickedTrue) output:
undefined
false
undefined
undefined
true
*note: if i use === instead of == it results in false either way.