DEV Community

Quách Ngọc Thành
Quách Ngọc Thành

Posted on

Cannot enter value into MDEditor

When I run the program, I can't enter a value in the input, help me

const handleChange = (event) => {
    const { name, value } = event.target;
    console.log(value);
    setData(data => ({
      ...data,
      [name]: value,
    }));
  }; 
  const handleSubmit = () => {
    setComments([...comments, { content: data.content }]);

  };
Enter fullscreen mode Exit fullscreen mode
const FormCommnent = ({ onChange, onSubmit, value }) => (
  <div className="form-comment">
      <MDEditor
        value={value}
        onChange={onChange}
        name="content"
        rows={4}
        autoFocus={0}
        preview='edit'
      />
      <MDEditor.Markdown source={value} />
      <Button htmlType="submit" onClick={onSubmit} >
        Add Comment
      </Button>
  </div>
);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)