From 02c7b10bbe204a5b8993d1b6f9d49c700d958373 Mon Sep 17 00:00:00 2001 From: Jamie Date: Mon, 9 Apr 2018 14:32:42 -0700 Subject: [PATCH] Update README.md --- README.md | 45 ++++++--------------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) 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 => [ -
, -
- ]} - ``` +