# React js - Crea un componente de estado

**URL:** <https://forum.freecodecamp.org/t/react-js-crea-un-componente-de-estado/578075>\
**Category:** General\
**Tags:** español\
**Created:** [December 15, 2022, 1:17am UTC](https://forum.freecodecamp.org/t/react-js-crea-un-componente-de-estado/578075 "2022-12-15T01:17:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![islasmartin308](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/islasmartin308/32/240217_2.png) [@islasmartin308](https://forum.freecodecamp.org/u/islasmartin308)\
**Post date:** [December 15, 2022, 1:17am UTC](https://forum.freecodecamp.org/t/react-js-crea-un-componente-de-estado/578075/1 "2022-12-15T01:17:40Z")

</div>

No entiendo como debo inicializar el estado del componente StateFulComponent

**Tu código hasta el momento**

```jsx
class StatefulComponent extends React.Component {
  constructor(props) {
    super(props);
    // Only change code below this line
this.state = {
  name : "FirstName"
}
    // Only change code above this line
  }
  render() {
    return (
      <div>
        <h1>{this.state.firstName}</h1>
      </div>
    );
  }
};

```

**Información de tu navegador:**

El agente de usuario es: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36`

**Desafío:** React js - Crea un componente de estado

**Enlaza al desafío:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/espanol/learn/front-end-development-libraries/react/create-a-stateful-component)**
>
> Aprende a programar, ¡GRATIS!

---

<div class="post-metadata">

**Author:** ![kevinSmith](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kevinsmith/32/72934_2.png) [@kevinSmith](https://forum.freecodecamp.org/u/kevinSmith)\
**Post date:** [December 15, 2022, 7:42am UTC](https://forum.freecodecamp.org/t/react-js-crea-un-componente-de-estado/578075/2 "2022-12-15T07:42:53Z")

</div>

> Inicia el componente con `state` en el `constructor` y asigna tu nombre a la propiedad`firstName` .

You have:

```auto
this.state = {
  name : "FirstName"
}

```

You have created a property “name” and give it the value “FirstName”.

You were asked to create a property “firstName” and give it the property of your name.

For example, if I was asked to do that with my last name, I would do:

```auto
this.state = {
  lastName : "Smith"
}

```

You are asked to do that with the property “firstName” and with your own first name.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 7, 2025, 3:40pm UTC](https://forum.freecodecamp.org/t/react-js-crea-un-componente-de-estado/578075/3 "2025-01-07T15:40:51Z")

</div>

Closed on January 7, 2025, 3:40pm UTC


