Triple Clicks
When I’m in the development phase of a project, I like to tweak forms to fill in all fields with one triple click event over one another element (div or header usually), just to avoid filling all the individual inputs by hand one by one. I choose triple clicks because it’s more difficult to perform them by users by error.
React Events
In Javascript we can attach custom events over the React components on the application, as we have the onClick
event and the onDoubleClick
event, but i can't realize how to make with more clicks. In other words, how to emulate the onTripleClick()
event.
Sample Code
render() {
return (
<FormComponent>
<FormHeader
onClick={this.doWhatever}
onDoubleClick={this.doMore}
onTripleClick={this.fillFormWithSampleData}
>
Create Promotion
</FormHeader>
{/* ... */}
{/* ... */}
{/* ... */}
{/* Tons of things here */}
</FormComponent>
);
}
I was wondering if someone knows if there’s a native way to deal with this in React, as I don’t want to use third party libraries nor jQuery. Any ideas on how to do this?