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

176
Vistas
set data to CKEditor from server in rect js after load data?

in my code want edit article item:

const [contentEditor, setContentEditor] = useState(null);


useEffect(() => {
        async function getLoadData(){
            setitem("");
            setContentEditor("");
        
            try{
                
                const data = await GetDataApi('/article/item?id='+ id);
                setIsLoading(false);

                if(data.status === 1){
                    setitem(data.content);
                    setContentEditor(data.content.text);
                }
                else{
                }
                
            }
            catch(e){
                return(
                    <div>error</div>
                )
            }
        }
        getLoadData();
    },[]);

in html

<CKEditor
    editor={ ClassicEditor }
    data={**contentEditor**}
    onReady={editor=>{}}                                
    onChange={ ( event, editor ) => {
         const data = editor.getData();
         setContentEditor(data);
    } }
 />

but not work and had error: A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component

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

0

I realized

CKEditor in react can't load data from server in onload component

I solved this way:

{
contentEditor&&
<CKEditor editor={ ClassicEditor } data={contentEditor} onReady={editor=>{}}
onChange={ ( event, editor ) => { const data = editor.getData(); setContentEditor(data); }} /> }

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