Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tizmagik/react-head

⛑ SSR-ready Document Head tag management for React 16+
https://github.com/tizmagik/react-head

hacktoberfest head isomorphic react server-side-rendering ssr

Last synced: 20 days ago
JSON representation

⛑ SSR-ready Document Head tag management for React 16+

Awesome Lists containing this project

README

        

# react-head [![npm Version](https://img.shields.io/npm/v/react-head.svg?style=flat-square)](https://www.npmjs.org/package/react-head) [![bundlephobia](https://badgen.net/bundlephobia/minzip/react-head)](https://bundlephobia.com/result?p=react-head) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](CONTRIBUTING.md#pull-requests)

Asynchronous SSR-ready Document Head management for React 16.3+

## Motivation

This module allows you to define `document.head` tags anywhere in your component hierarchy. The motivations are similar to [react-helmet](https://github.com/nfl/react-helmet) in that you may only have the information for certain tags contextually deep in your component hiearchy. There are no dependencies (it does not use react-side-effects) and it should work fine with asynchronous rendering; the only requirement is React 16.3+.

[Read more about react-head and how it works on Medium](https://jeremygayed.com/making-head-tag-management-thread-safe-with-react-head-323654170b45)

## Installation

```sh
npm i react-head
```

or

```sh
yarn add react-head
```

## How it works

1. You wrap your App with ``
1. From the server, you pass `headTags[]` array to ``
1. Then call `renderToStaticMarkup(headTags)` and include in the `

${app}