I'm busy with this course and almost to the end. One of the challenges at the end stated to add code to do the CRUD operations on the content of the page. So I have this code from the course:
function CreatePageForm( { onCancel, onSaveFinished } ) { const [title, setTitle] = useState(); const { lastError, isSaving } = useSelect( ( select ) => ( { lastError: select( coreDataStore ) .getLastEntitySaveError( 'postType', 'page' ), isSaving: select( coreDataStore ) .isSavingEntityRecord( 'postType', 'page' ), } ), [] ); const { saveEntityRecord } = useDispatch( coreDataStore ); const handleSave = async () => { const savedRecord = await saveEntityRecord( 'postType', 'page', { title, status: 'publish' } ); if ( savedRecord ) { onSaveFinished(); } }; return ( <PageForm title={ title } onChangeTitle={ setTitle } hasEdits={ !!title } onSave={ handleSave } lastError={ lastError } onCancel={ onCancel } isSaving={ isSaving } /> ); } Can I now add something like this:
[content, setContent] = useState() and work from there on further?