Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
Adding Properties boxes on the spot inside a form tag

i have the following elements: Html format

In react I just declared the following:

  const [type, setType] = useState("");
  const [propertyName, setPropertyName] = useState("");

The html is the following:

           <div>
            <label htmlFor='properties' className='properties-label'>
              Properties
            </label>
            <div className='property-box'>
              <input
                type='text'
                id='type'
                placeholder='Type'
                className='type-element'
                required
                onChange={(e) => setType(e.target.value)}
              ></input>
              <input
                type='text'
                id='name'
                className='type-element'
                placeholder='Name'
                required
                onChange={(e) => setPropertyName(e.target.value)}
              ></input>
              <button className='buttonAccount' type='submit'>
                Add Property
              </button>
            </div>
          </div>

What I want to basically is somehow to add a property, containing the two values. I was thinking using an array to store some objects like the following example: { type: card name: Dragon }

But I don't really know how to tackle this problem. Should I first create an empty array and then store those two fields in an object? How is this done? How can I make sure that both of the fields are completed(they shouldn't go to the database if one of them is empty). After these two fields are inputted I want a new element appear right underneath those fields, like a paragraph with the data that I introduced, an example that I saw is familiar with this is on OpenSea, when creating an NFT(https://opensea.io/asset/create) Can somebody explain me a way to solve this problem?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

you can have a look on this code

https://codesandbox.io/s/crazy-lake-059b82?file=/src/App.js:0-1339

to make paragraph visible create one more state and update it on handleClick function

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda