react-input-trigger icon indicating copy to clipboard operation
react-input-trigger copied to clipboard

Cant set endTrigger with React Hook useState

Open conwayconstar opened this issue 6 years ago • 3 comments

I am using a functional component and I am unable to set the endTrigger with a set state function

<InputTrigger
        trigger={{
          keyCode: 50,
          shiftKey: true,
        }}
        onType={toggleSuggesting}
        onCancel={toggleSuggesting}
        endTrigger={setEndMention}
      >

conwayconstar avatar Sep 04 '19 04:09 conwayconstar

Did you manage this @fullstackedkush ?

ghost avatar Feb 13 '20 21:02 ghost

I did not unfortunately, I used useRef to set a reference and created my own trigger to reset it with ref.current.resetState();

conwayconstar avatar Feb 14 '20 09:02 conwayconstar

@fullstackedkush Had to assign to a variable to make it work, not the best solution, but it works. I'll change to your solutions, seems much cleaner to me.

ghost avatar Feb 14 '20 18:02 ghost