My property in my state looks like this:
state: {
styling: {
styling: {
card: {
height: auto;
}
}
}
}
I want the height property to update on user input from an Input element, so I created a function like this:
handleCardChange = (event, style) => {
let property = "styling.styling." + style;
let updatedState = {
"styling.styling.card.height": event.target.value
}
console.log(updatedState);
this.setState(updatedState);
}
where the style parameter is a string containing the path to the property being updated, in this cased "card.height". I created an object for the new state and tried passing it into setState but it doesn't update the height property.
Anyone know how to solve this problem? I'm stumped!