react-helmet-async
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "react-helmet-async", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Thread-safe Helmet for React 16+ and friends", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
# react-helmet-async | ||
This package is a fork of [React Helmet](https://github.com/nfl/react-helmet). | ||
This package is a fork of [React Helmet](https://github.com/nfl/react-helmet). | ||
`<Helmet>` usage is synonymous, but SSR is radically different. | ||
`react-helmet` relies on `react-side-effect`, which is not thread-safe. If you are doing anything asynchronous on the server, | ||
`react-helmet` relies on `react-side-effect`, which is not thread-safe. If you are doing anything asynchronous on the server, | ||
you need Helmet to to encapsulate data on a per-request basis, this package does just that. | ||
@@ -11,7 +11,7 @@ | ||
The main way that this package differs from `react-helmet` is that it requires using a Provider to encapsulate Helmet state for your React | ||
The main way that this package differs from `react-helmet` is that it requires using a Provider to encapsulate Helmet state for your React | ||
tree. If you use libraries like Redux or Apollo, you are already familiar with this paradigm: | ||
```javascript | ||
import HelmetProvider from 'react-helmet-async/lib/Provider'; | ||
import Helmet, { HelmetProvider } from 'react-helmet-async'; | ||
@@ -31,3 +31,3 @@ const app = ( | ||
On the server, we will no longer use static methods to extract state. `react-side-effect` | ||
On the server, we will no longer use static methods to extract state. `react-side-effect` | ||
exposed a `.rewind()` method, which Helmet used when calling `Helmet.renderStatic()`. Instead, we are going | ||
@@ -37,3 +37,3 @@ to pass a `context` prop to `HelmetProvider`, which will hold our state specific to each request. | ||
```javascript | ||
import HelmetProvider from 'react-helmet-async/lib/Provider'; | ||
import { HelmetProvider } from 'react-helmet-async'; | ||
@@ -61,3 +61,3 @@ const helmetContext = {}; | ||
This package only works with streaming if your `<head>` data is output outside of `renderToNodeStream()`. | ||
This package only works with streaming if your `<head>` data is output outside of `renderToNodeStream()`. | ||
This is possible if your data hydration method already parses your React tree. Example: | ||
@@ -69,4 +69,3 @@ | ||
import { getDataFromTree } from 'react-apollo'; | ||
import Helmet from 'react-helmet-async'; | ||
import HelmetProvider from 'react-helmet-async/lib/Provider'; | ||
import Helmet, { HelmetProvider } from 'react-helmet-async'; | ||
import template from 'server/template'; | ||
@@ -109,2 +108,2 @@ | ||
.pipe(res); | ||
``` | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
257787
104