You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A hook holds a `state` that lives through the entire life of a **hook context**. For the Express application, this context lives through the entire request lifecycle thanks to the `hooksMidleware`. For a standalone app, this context lives in all the functions called (even deeper function calls) from the `runHookContext` function.
98
+
A hook holds a `state` that lives through the entire life of a **hook context**. For the Express application, this context lives through the entire request lifecycle thanks to the express (or other runtime) `middleware`. For a standalone app, this context lives in all the functions called (even deeper function calls) from the `runHookContext` function.
99
99
100
100
This is made possible thanks to the [`AsyncLocalStorage`](https://nodejs.org/dist/latest-v18.x/docs/api/async_context.html#class-asynclocalstorage) nodeJS API
101
101
@@ -173,12 +173,12 @@ Hook states can be updated at runtime. If the counter has to start at 50, it can
This is exactly how the `hooksMiddleware` works. It runs a context for the current request, uses the state updater of the `useHeaders` hook and attach the values from the `req` express object.
190
+
This is exactly how the `middleware` works. It runs a context for the current request, uses the state updater of the `useHeaders` hook and attach the values from the `req` express object.
191
191
192
192
The `useHeaders()` function can now magically return the values of the request headers through the entire request lifecycle.
193
193
@@ -198,18 +198,17 @@ Don't hesitate to open an issue if you want to use hooks with another framework.
0 commit comments