How to use react-helmet-async - 6 common examples

To help you get started, we’ve selected a few react-helmet-async examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tomatau / breko-hub / test / test-setup.js View on Github external
import { isBrowser, ConfigService } from 'app/utils'
import appConfig from 'config/app.config'
import helpers from './test-helpers'

configure({ adapter: new ReactSixteenAdapter() })

chai.use(require('chai-shallow-deep-equal'))
chai.use(require('chai-as-promised'))
chai.use(require('chai-enzyme')())
chai.use(require('sinon-chai'))
chai.use(require('chai-generator'))
chai.use(require('chai-jest-snapshot'))

process.env.APP_CONFIG = JSON.stringify(appConfig)

Helmet.defaultProps.defer = false

setGlobals(isBrowser ? window : global)

function setGlobals(global) {
  ConfigService.setEnv(process.env.CONFIG_ENV)
  ConfigService.assignVars(process.env.APP_CONFIG)

  global.global = global

  global.expect = expect
  global.sinon = sinon

  global.snap = snap

  global.shallow = shallow
  global.mount = mount
github xing / hops / packages / template-graphql / src / home / spec / index.spec.js View on Github external
import React from 'react';
import renderer from 'react-test-renderer';
import { HelmetProvider } from 'react-helmet-async';
import { Home } from '../';

HelmetProvider.canUseDOM = false;

it('renders loading state correctly', () => {
  const tree = renderer
    .create(
      <HelmetProvider>
        <Home data={{ loading: true }} />
      </HelmetProvider>
    )
    .toJSON();
  expect(tree).toMatchSnapshot();
});

it('renders loaded state correctly', () => {
  const data = {
    loading: false,
    github: {
github xing / hops / packages / template-redux / src / home / spec / index.spec.js View on Github external
import React from 'react';
import renderer from 'react-test-renderer';
import { HelmetProvider } from 'react-helmet-async';
import Home from '../';

HelmetProvider.canUseDOM = false;

it('renders correctly', () => {
  const tree = renderer
    .create(
      <HelmetProvider>
        <Home />
      </HelmetProvider>
    )
    .toJSON();
  expect(tree).toMatchSnapshot();
});
github xing / hops / packages / template-react / src / home / spec / index.spec.js View on Github external
import React from 'react';
import renderer from 'react-test-renderer';
import { HelmetProvider } from 'react-helmet-async';
import Home from '../';

HelmetProvider.canUseDOM = false;

it('renders correctly', () => {
  const tree = renderer
    .create(
      <HelmetProvider>
        <Home />
      </HelmetProvider>
    )
    .toJSON();
  expect(tree).toMatchSnapshot();
});
github sharetribe / ftw-daily / src / app.js View on Github external
export const ServerApp = props => {
  const { url, context, helmetContext, store } = props;
  setupLocale();
  HelmetProvider.canUseDOM = false;
  return (
    <IntlProvider locale={config.locale} messages={localeMessages}>
      <Provider store={store}>
        <HelmetProvider context={helmetContext}>
          <StaticRouter location={url} context={context}>
            <Routes routes={routeConfiguration()} />
          </StaticRouter>
        </HelmetProvider>
      </Provider>
    </IntlProvider>
  );
};
github storybookjs / storybook / lib / ui / src / index.js View on Github external
import { DOCS_MODE } from 'global';
import React from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';

import { Location, LocationProvider } from '@storybook/router';
import { Provider as ManagerProvider } from '@storybook/api';
import { ThemeProvider, ensure as ensureTheme } from '@storybook/theming';
import { HelmetProvider } from 'react-helmet-async';

import App from './app';

import Provider from './provider';

ThemeProvider.displayName = 'ThemeProvider';
HelmetProvider.displayName = 'HelmetProvider';

const getDocsMode = () => {
  try {
    return !!DOCS_MODE;
  } catch (e) {
    return false;
  }
};

const Container = process.env.XSTORYBOOK_EXAMPLE_APP ? React.StrictMode : React.Fragment;

export const Root = ({ provider }) => (
  <Container key="container">
    <HelmetProvider key="helmet.Provider">
      <LocationProvider key="location.provider">
        <Location key="location.consumer">

react-helmet-async

Thread-safe Helmet for React 16+ and friends

Apache-2.0
Latest version published 8 months ago

Package Health Score

81 / 100
Full package analysis