Coder Social home page Coder Social logo

tomleb3 / react-headband Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3 KB

A controller for your document titles

Home Page: https://www.npmjs.com/package/react-headband

TypeScript 100.00%
react react-headband headband document title controller npm npm-package npm-module

react-headband's Introduction

react-headband

A simple controller for your document titles

NPM JavaScript Style Guide

Install

npm install --save react-headband

Description

react-headband is a lightweight, zero-dependency package that allows you to easily set your document's titles for different routes.

Usage

In-order to use react-headband, simply import it into your project, then wrap each route declaration with Headband, while setting the desired title as a parameter.

You can add the optional scrollToTop parameter if you wish for that behavior when navigating to the route.

Example:

import React from "react";

import Headband from "react-headband";

import Page1 from "pages/page1";
import Page2 from "pages/page2";

function App() {
  return (
    <Headband title="Page no. 1">
      <Page1 />
    </Headband>
    <Headband title="Page no. 2" scrollToTop>
      <Page2 />
    </Headband>
  );
}

Notes

  • To avoid mismatch between titles and routes, make sure to use Headband on all routes.

License

MIT © tomleb3

react-headband's People

Contributors

tomleb3 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.