Skip to main content

FetchEventProvider

Overview

FetchEventProvider

(props, context?): `null` | `ReactElement<any, any>`

Context for consuming the current FetchEvent in a React component.

Note that when used with RequestRouter, context hooks are only available within the React component returned by a route handler:

const PageComponent: React.FC = () => {
const { params } = useParams()
return <div>Foo</div>

const app = new RequestRouter()

app.get('/foo', () => {
return <PageComponent />
})

If you need to access the FetchEvent before the React component is rendered, use the event parameter passed to the route handler.

Parameters

NameType
propsMiddlewareContextProps
context?any

Returns

null | ReactElement<any, any>

Defined in

node_modules/@types/react/index.d.ts:520