Skip to content

Commit ce3c1f8

Browse files
authored
docs: Rewrite hooks intro blurb (#1302)
1 parent 8d8da52 commit ce3c1f8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

content/en/guide/v10/hooks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ description: Hooks in Preact allow you to compose behaviours together and re-use
55

66
# Hooks
77

8-
The Hooks API is a new concept that allows you to compose state and side effects. Hooks allow you to reuse stateful logic between components.
8+
The Hooks API is an alternative way to write components in Preact. Hooks allow you to compose state and side effects, reusing stateful logic much more easily than with class components.
99

10-
If you've worked with Preact for a while, you may be familiar with patterns like "render props" and "higher order components" that try to solve these challenges. These solutions have tended to make code harder to follow and more abstract. The hooks API makes it possible to neatly extract the logic for state and side effects, and also simplifies unit testing that logic independently from the components that rely on it.
10+
If you've worked with class components in Preact for a while, you may be familiar with patterns like "render props" and "higher order components" that try to solve these challenges. These solutions have tended to make code harder to follow and more abstract. The hooks API makes it possible to neatly extract the logic for state and side effects, and also simplifies unit testing that logic independently from the components that rely on it.
1111

1212
Hooks can be used in any component, and avoid many pitfalls of the `this` keyword relied on by the class components API. Instead of accessing properties from the component instance, hooks rely on closures. This makes them value-bound and eliminates a number of stale data problems that can occur when dealing with asynchronous state updates.
1313

0 commit comments

Comments
 (0)