1.0.2 • Published 2 years ago

react-head-manifest v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-head-manifest

Define your SPA head information from a single manifest file

NPM JavaScript Style Guide

Install

This project requires react-router-dom to be installed.

yarn add react-router-dom
yarn add react-head-manifest

Usage

Using React Head Manifest is as easy as creating/importing a head-manifest.json file with your manifest data, and using the useHeadManifest hook provided by the library.

Example:

import React from 'react'
import {
    BrowserRouter as Router,
    Switch,
    Route,
    Link,
} from 'react-router-dom'
import useHeadManifest from 'react-head-manifest'

// Load your head manifest file
const headManifest = require('./head-manifest.json');

// Base App component
const App = () => {
    return (
        <Router>
            <RoutedApp />
        </Router>
    )
}

// Routed app component, has access to react-router-dom
const RoutedApp = () => {

    useHeadManifest(headManifest)

    return ( ... )
}

export default App

This project is intended for use with our sister project Laravel Head Manifest,

License

MIT © NichoCM