Skip to content
Advertisement

Converting a class to a function

I need to convert the given class component into a functional one.

I’m working with outputting an array of multiple Editors draft-js and I’m having some trouble outputting them. On the internet, I found a working class component with an array of them, but I can’t convert it into a functional component for TS or JS.

JavaScript

Can someone have enough experience to help me with this?

Advertisement

Answer

Try to change your code like this:

JavaScript

You can store the editorStates using the useState hook, and update it using the provided function.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement