What is the TypeScript definition for the onFocusCapture event in React?

The right interface for onFocusCapture is FocusEvent

Please continue reading below to see how to use it or read my guide on using React's events with TypeScript.


interface FocusEvent<T = Element> extends SyntheticEvent<T, NativeFocusEvent> {
    relatedTarget: EventTarget | null;
    target: EventTarget & T;

Full example

import React, { FocusEvent } from 'react';

const InputComponent = () => {
  const handleFocusEvent = (e: FocusEvent<HTMLInputElement>) => {
    // Do something

  return <input value="Some text" onFocusCapture={handleFocusEvent} />;

export default InputComponent;

Attributes that use FocusEvent: