1 | # Changelog
|
2 |
|
3 | ## v2.0.0 (2019-03-12)
|
4 |
|
5 | - Report violations whenever a React hook is used after an early return.
|
6 |
|
7 | For example, the following code sample now violates the rule:
|
8 |
|
9 | ```tsx
|
10 | function MyComponent({ counter }) {
|
11 | if (counter > 5) {
|
12 | return <div>Counter is over 5</div>;
|
13 | }
|
14 |
|
15 | useEffect(() => {
|
16 | console.log('Counter is', counter);
|
17 | });
|
18 |
|
19 | return <div>{counter}</div>;
|
20 | }
|
21 | ```
|
22 |
|
23 | ## v1.1.0 (2019-02-09)
|
24 |
|
25 | - Allow using hooks inside React component decorators, such as `React.memo` or `React.forwardRef`.
|
26 |
|
27 | For example, the following code sample now **does not** violate the rule:
|
28 |
|
29 | ```tsx
|
30 | const MyComponent = React.memo(props => {
|
31 | useEffect(() => {
|
32 | console.log('Counter changed');
|
33 | }, [props.value]);
|
34 |
|
35 | return <div>Counter: {props.value}</div>;
|
36 | });
|
37 | ```
|
38 |
|
39 | ## v1.0.1 (2019-02-03)
|
40 |
|
41 | - Updated README
|
42 |
|
43 | The source code of the rule did not change. The rule has been released again so that the README on
|
44 | npmjs.com matches the one on GitHub.
|
45 |
|
46 | ## v1.0.0 (2019-02-03)
|
47 |
|
48 | - The initial implementation of the rule
|
49 |
|
\ | No newline at end of file |