Estoy tratando de reutilizar un objeto en diferentes componentes, por lo que mi obj inicial. está vacío, pero cuando lo exporto a mi componente y configuro State en obj., no borra el estado. pero cuando consola.log el obj., vuelve como se esperaba. ¿alguna idea de por qué sucede esto?
this.state = { name: '', lastName: '', age: 0, kids: 0 } const myEmptyObj = { name: '', lastName: '', age: 0 } // lets pretend this function has name, lastName, age, and kids with values // this function should clear the state but update the kids to value 3. so everything // empty but the kids field myFunctionClearState() { myEmptyObj.kids = 3; setState(myEmptyObj); }