Can someone please explain the code to me? I am not able to understand why the code says !toggle inside onClick and ? inside return In short the code is confusing to me as I am a beginner.
Ant help will be much appreciated.
import {useState} from 'react';
const Toggle = ({children}) => {
const [toggle,setToggle] = useState(true);
return (
<div onClick={() => setToggle(!toggle)}>
{toggle ? children: ""}
</div>
)
}
export default Toggle