File tree Expand file tree Collapse file tree 1 file changed +8
-26
lines changed
website/content/docs/rules Expand file tree Collapse file tree 1 file changed +8
-26
lines changed Original file line number Diff line number Diff line change @@ -40,39 +40,21 @@ An **unsafe** codemod is available for this rule.
4040``` tsx
4141import { useContext } from " react" ;
4242
43- const MyComponent = () => {
44- const value = useContext (MyContext );
45- return <div >{ value } </div >;
46- };
47- ```
48-
49- ``` tsx
50- import React from " react" ;
51-
52- const MyComponent = () => {
53- const value = React .useContext (MyContext );
54- return <div >{ value } </div >;
55- };
43+ function Button() {
44+ const theme = useContext (ThemeContext );
45+ // ...
46+ }
5647```
5748
5849### Passing
5950
6051``` tsx
6152import { use } from " react" ;
6253
63- const MyComponent = () => {
64- const value = use (MyContext );
65- return <div >{ value } </div >;
66- };
67- ```
68-
69- ``` tsx
70- import React from " react" ;
71-
72- const MyComponent = () => {
73- const value = React .use (MyContext );
74- return <div >{ value } </div >;
75- };
54+ function Button() {
55+ const theme = use (ThemeContext );
56+ // ...
57+ }
7658```
7759
7860## Implementation
You can’t perform that action at this time.
0 commit comments