Draft.js uncontrolled input problem

(Saša Fišter) #1

Hi guys,

I used Draft.js as WYSIWYG, but I have it as a component which receives data through props. Problem is that I get this error:

Warning: AddCustomCourse is changing a controlled input of type text to be uncontrolled. Input elements should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component.

Anyone knows how to solve this issue?

(jean-baptiste cazaux) #2

i havent test it but in handleInput you do:
[name]: value
and in your input: name=“title” value={this.state.course.title}
It seems a ‘course’ is missing somewhere in your handleInput.

Not sure about the [name]: value syntax but i guess you tested it ?