Skip to content

Input box input value enter, the value has been displayed empty, enter can continue to add! #1

Open
@liancheng-zcy

Description

@liancheng-zcy
 function handleInputEnter(event: React.KeyboardEvent) {
    if (event.key === 'Enter' && formState !== '') {
      const newTodo: TodoInterface = {
        id: shortid.generate(), 
        text: formState,
        isCompleted: false
      }
      props.handleTodoCreate(newTodo)
      setFormState('')
      if (inputRef && inputRef.current) {
        inputRef.current.value = ''
      }
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions