79312534

Date: 2024-12-27 18:27:23
Score: 0.5
Natty:
Report link

You can use spread operator syntax(this creates a shallow copy too but you may save some of your hassle) For eg,

const [object , setObject] = useState({ prop1:val1, prop2:val2, prop3:val3, });

Now, while changing the state : useState( {...object, propertyToBeChanged:newValue} )

Reasons:
  • Whitelisted phrase (-1.5): You can use
  • Low length (0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Tazim Esaf roll no 26