Editor hooks style

4 posts, 1 answers
  1. Justin
    Justin avatar
    2 posts
    Member since:
    Mar 2015

    Posted 17 May 2020 Link to this post

    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.

  2. Answer
    Stefan
    Admin
    Stefan avatar
    3039 posts

    Posted 18 May 2020 Link to this post

    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.
  3. Justin
    Justin avatar
    2 posts
    Member since:
    Mar 2015

    Posted 21 May 2020 in reply to Stefan Link to this post

    Thanks a lot for the response, is your example the prefered method? Rather than using onChange and storing the change in a hook useState.
  4. Stefan
    Admin
    Stefan avatar
    3039 posts

    Posted 21 May 2020 Link to this post

    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.
Back to Top