Focus


React Components Public New

Easy 

15min


The TextInput component renders an input element in the DOM and accepts a ref that is forwarded to that input element. Finish the FocusableInput component:

  • The component should accept a focused prop.
  • When the focused prop is changed from false to true, and the input is not focused, it should receive the focus.
  • If on mounting the focused prop is true, the input should receive the focus.
HTML5, CSS3
   

Run OK, but 2 out of 2 test cases fail:

  •   Property focused is true initially and the input has focus: Wrong answer
  •   Changing the focused prop focuses the input: Wrong answer