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

202
Vistas
When displaying an image, which of the following two measures should be taken with React

I wrote the following code in React.

 const onChangeImage = (e, setState) => {
        const file = e.target.files[0]
        if (e.target.files && e.target.files[0]) {
            // 画像を格納
            reader.onload = (data) => {
                dispatch({
                    type: 'SET_SALON_DATA',
                    payload: {
                        title: e.target.name,
                        content: file
                    }
                })
                // this!!
            }
            reader.readAsDataURL(file)
        }
    }

At "this!!" point,which method is better? This state goes into the url of the img tag.

setState(URL.createObjectURL(file))

or

setState(data.target.result))

I'm waiting for your answer!

about 4 years ago · Juan Pablo Isaza
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