sobota 31. března 2018

Jak nastavit title a favicon v React

Jednoduché použití s react-helmet

Pomocí npm naistalujte react-helmet

npm install --save react-helmet

Do úvodu v App.js vložte

import {Helmet} from 'react-helmet'; 
import favicon from '../img/favicon.ico';

V render() stránky pak uveďte:

class Application extends React.Component {
  render () {
    return (
        <div className="application">
            <Helmet>
                <meta charSet="utf-8" />
                <title>My Title</title>
                <link rel="icon" href={favicon} />
            </Helmet>
            ...
        </div>
    );
  }
};



Žádné komentáře:

Okomentovat