Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

229
Visualizações
How to efficiently store data from react-quill to backend

I am making a simple blogging site using react, I am using react-quill and i can't figure out the best way to store the data from react-quill editor to the backend. From my code, the content I get is already formatted with html tags. I would like to store the data in a way that when It is stored efficiently and when retrieved from the server, it is displayed with all the formatting e.g bold text, italized... The sample code is below. Also if there is a way i can improve my code, feel free to tell me :)

import { useState } from 'react';
import ReactQuill from "react-quill";
import "react-quill/dist/quill.snow.css";
import "react-quill/dist/quill.bubble.css";

const Create = () => {
    const [body, setBody] = useState('');
    const handleBody = (e) => {
        console.log(e)
        setBody(e)
    }
    return (
        <main>
            <div className="form-container">
                <form>
                    <h2>create post</h2>
                    <ReactQuill
                        placeholder='spread your message...'
                        modules={Create.modules}
                        formats={Create.formats}
                        onChange={handleBody}
                        value={body}
                    />
                    <button id="submit-btn">post</button>
                </form>
            </div>
        </main>
    )
}

Create.modules = {
    toolbar: [
      [{ 'font': [] }],
      [{ 'size': ['small', false, 'large', 'huge'] }],
      ['bold', 'italic', 'underline'],
      [{'list': 'ordered'}, {'list': 'bullet'}],
      [{ 'align': [] }],
      [{ 'color': [] }, { 'background': [] }],
      ['link', 'image'],
      ['code-block'],
      ['clean']
    ]
};

Create.formats = [
    'font',
    'size',
    'bold', 'italic', 'underline',
    'list', 'bullet',
    'align',
    'color', 'background',
    'link',
    'image',
    'code-block'
  ];

export default Create;
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda