This is a migrated thread and some comments may be shown as answers.

Editor hooks style

3 Answers 84 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 17 May 2020, 08:09 PM

How do you write this in hooks style?

 

https://www.telerik.com/kendo-react-ui/components/editor/content/

 

using class references defies the point of hooks.

3 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 18 May 2020, 01:38 PM

Hello, Justin,

I transferred the example to use functional components:

https://stackblitz.com/edit/react-14sdub?file=app/main.jsx

I hope this is helpful.

Regards,
Stefan
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Justin
Top achievements
Rank 1
answered on 21 May 2020, 11:34 AM
Thanks a lot for the response, is your example the prefered method? Rather than using onChange and storing the change in a hook useState.
0
Stefan
Telerik team
answered on 21 May 2020, 01:45 PM

Hello, Justin,

Both approaches are valid.

The main advantage of this approach is not to update the Editor content on each change as with very large and complex documents this could become slower as the content grows.

For smaller documents the on change event is a very good choice. This is what we use in an example where we have the Editor inside a Form component.

Regards,
Stefan
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
General Discussions
Asked by
Justin
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Justin
Top achievements
Rank 1
Share this question
or