I have a component that receives a prop that looks like this:
const styles = {
font: {
size: {
value: \'22\',
unit: \'px\'
Your code for default useState is invalid. You should write like below for default useState:
const { ...styling } = styles;
const [style, setStyle] = useState({ styling }); // styling should be use in {}
return (
{
setStyle({
...styling,
font: { ...styling.font, align: event.target.value }
});
console.log(style);
}}
/>);
Demo:
check this demo with console.log
.