You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How would I make an API output inside of the Slate text-editor?
E.g. (This does not work).
importReact,{useState}from'react';import{Editor}from'slate-react';constMyComponent=()=>{const[data,setData]=useState([]);// Fetch the data from the API and update the component's stateuseEffect(()=>{fetch('https://my-api.com/data').then(res=>res.json()).then(json=>setData(json));},[]);return(<Editorvalue={data}onChange={newData=>setData(newData)}/>);}
Any help would be much appreciated.
I would also like to know why the following does not work.
E.g. (This does not work).
Any help would be much appreciated.
I would also like to know why the following does not work.
Originally posted by @NorkzYT in #5217
The text was updated successfully, but these errors were encountered: