Skip to content

Commit

Permalink
docs(Plugins-Guide.md) : add this reminder (#4117)
Browse files Browse the repository at this point in the history
* Update Plugins-Guide.md

added a reminder when using decorateReply and decorateRequest

* Update Plugins-Guide.md

* Update Plugins-Guide.md
  • Loading branch information
mrdcvlsc committed Jul 5, 2022
1 parent 515577a commit 3d3c8fb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/Guides/Plugins-Guide.md
Expand Up @@ -196,6 +196,11 @@ fastify.get('/html', (request, reply) => {
reply.html({ hello: 'world' })
})
```
Reminder that the `this` keyword is not available on *arrow functions*,
so when passing functions in *`decorateReply`* and *`decorateRequest`* as
a utility that also needs access to the `request` and `reply` instance,
a function that is defined using the `function` keyword is needed instead
of an *arrow function expression*.

In the same way you can do this for the `request` object:
```js
Expand Down

0 comments on commit 3d3c8fb

Please sign in to comment.