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

242
Vistas
MERN: Refresh loads raw data

Why does my deployed MERN app return raw data on page refresh?

When a specific get request is called, raw data from mongo displays on the screen like this. I just deployed to Heroku and this issue does not happen on my local server. My thinking is that the issue could be with Editor.js, however, a boolean state change is used to delay render until all data is loaded.

The data returned is correct, so the Axios call is successful. It's just weird that the React component isn't being rendered.

On refresh, this is called:

 useEffect(() => {
    initialDataLoadEditor();
  }, []);

  async function initialDataLoadEditor() {
    try {
      const response = await axios.get(`/document/${id}`);

      setData(response.data);
      setIsLoaded(true);
    } catch (error) {
      console.error(error);
    }
  }

if (isLoaded === false) {
    return <div>LOADING...</div>;
  } return (
      <div>

        <div className='flex justify-center'>
          <label >
            <TextareaAutosize
              className={`  mt-2 mb-2  flex-child outline-none resize-none text-2xl font-bold`}
              type="text"
              ref={nameRef}
              defaultValue={data.name}
              onChange={(e) => handleSave(e)}
            />
          </label>
        </div>

        <EditorJs
          instanceRef={(instance) => (instanceRef.current = instance)}
          placeholder="Start typing what's in your head..."
          tools={EDITOR_JS_TOOLS}
          enableReInitialize={true}
          data={data.components[0]}
          onChange={(e) => handleSave(e)}
        />
      </div>
    );

Been working on this since the AM and I'm really not sure what's going on. Any idea how to render the React component? Thank you!

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