Skip to content

Commit 33346e3

Browse files
author
Dustin Masters
committed
Move context warning to a note
1 parent 2e115b8 commit 33346e3

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

content/docs/reference-react-component.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,9 @@ Beware of this pattern, as state won't be up-to-date with any props update. Inst
158158

159159
If you "fork" props by using them for state, you might also want to implement [`componentWillReceiveProps(nextProps)`](#componentwillreceiveprops) to keep the state up-to-date with them. But lifting state up is often easier and less bug-prone.
160160

161-
Some libraries, such as React Router, may depend on [context](/docs/context.html) being available. If you implement a constructor and need context, make sure to call `super(props, context)`.
162-
163-
```js
164-
constructor(props, context) {
165-
super(props, context);
166-
// other component initialization logic
167-
}
168-
```
161+
> Note
162+
>
163+
> Some libraries, such as React Router, may depend on [context](/docs/context.html) being available. If you implement a constructor and need context, make sure to call `super(props, context)` from the [constructor](/docs/context.html#referencing-context-in-lifecycle-methods).
169164
170165
* * *
171166

0 commit comments

Comments
 (0)