Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!