functional component example

Hi,
All your React source code example are for class based components.
Can you give examples for functional components using hooks e.g. useState() etc.

Thanks


3 Replies 1 reply marked as answer

SP Sowmiya Padmanaban Syncfusion Team December 14, 2020 11:41 AM UTC

 
Hi Justin Elliott Neal,  
 
Greetings from Syncfusion support. 
 
Query - Can you give examples for functional components using hooks e.g. useState() etc. 
 
Yes, you can render the sidebar as a functional component in react platform using react hooks. For your reference, we have render the Sidebar component as a functional component. 
 
Please, refer the below sample link: 
 
 
Please, refer the below KB link for your reference. 
 
 
Please let us know, if you need any further assistance. 
 
Regards,  
Sowmiya.P 


Marked as answer

SE sebastian January 18, 2022 03:46 PM UTC


where can i find the word editor but in functional components



SM Suriya Murugan Syncfusion Team January 20, 2022 03:54 AM UTC

Hi Sebartian, 

We have created DocumentEditor using React Hooks functional Component by two different ways.  

React Hooks:  

 
1.      Created DocumentEditor control by using below code snippet:  
<DocumentEditorContainerComponent width='100%' height='650px' enableToolbar={true} created={onCreated}  ref={initDocEditor}>  
           
        </DocumentEditorContainerComponent>  
  
 
2.      Container Reference binded by using initDocEditor method.  
const [docEditor, setDocEditor] = useState(null);  
  
  const initDocEditor = (editor) => {  
     if (editor && !docEditor) {  
      setDocEditor(editor);  
    }  
  }  
  
//You can access container instance by using docEditor variable  
 

Please let us know if you have any questions. 

Regards, 
Suriya M. 


Loader.
Up arrow icon