diff --git a/README.md b/README.md index 0cd34c9..f570bae 100644 --- a/README.md +++ b/README.md @@ -72,52 +72,19 @@ class Title extends React.Component<{ children: Node }> { } ``` -## Usage with React 15 and below +## Compatibility -`Provider` just returns its children in its `render` method, and `Consumer` returns the result of child function call. This means that whatever value you give as `Provider` children, or return from `Consumer` child function, it should be a valid `render` return type for your current React version. For React 15, it includes React element, boolean, and null, but doesn't include fragments (arrays), strings, or numbers. +This package only "ponyfills" the `React.createContext` API, not other +unrelated React 16+ APIs. If you are using a version of React <16, keep +in mind that you can only use features available in that version. +For example, you cannot pass children types aren't valid pre React 16: ```js -// Works in React 15 and below - -foo - - -
-
-
-
- - -{value => {Number(value)}} - - - {value => ( -
-
-
-
- )} - -``` - -```js -// Doesn't work in React 15 and below - -foo -
- -{value => Number(value)} - - - {value => [ -
, -
- ]} - ``` +