How to use the react-universal-component function in react-universal-component

To help you get started, we’ve selected a few react-universal-component 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 go-faast / faast-web / dist / react-static-routes.js View on Github external
setHasBabelPlugin()

const universalOptions = {
  loading: () => null,
  error: props => {
    console.error(props.error);
    return <div>An error occurred loading this page's template. More information is available in the console.</div>;
  },
}

  const t_0 = universal(import('../../src/site/pages/Home'), universalOptions)
const t_1 = universal(import('../../src/site/pages/Terms'), universalOptions)
const t_2 = universal(import('../../src/site/pages/Privacy'), universalOptions)
const t_3 = universal(import('../../src/site/pages/Pricing'), universalOptions)
const t_4 = universal(import('../../src/site/pages/404'), universalOptions)


// Template Map
global.componentsByTemplateID = global.componentsByTemplateID || [
  t_0,
t_1,
t_2,
t_3,
t_4
]

// Template Tree
global.templateIDsByPath = global.templateIDsByPath || {
  '404': 4
github drupal-graphql / drupal-decoupled-app / frontend / app / screens / ArticleOverview / index.js View on Github external
// @flow

import universal from 'react-universal-component';
import { withPreloading } from 'react-preload-universal-component';

export default withPreloading(universal(import('ArticleOverview/component')));
github drupal-graphql / drupal-decoupled-app / frontend / app / screens / SplatRouter / index.js View on Github external
// @flow

import universal from 'react-universal-component';
import { withPreloading } from 'react-preload-universal-component';

export default withPreloading(universal(import('SplatRouter/component')));
github strues / boldr / packages / frontend / src / scenes / Blog / TagList / index.js View on Github external
// @flow
import React from 'react';
import { graphql } from 'react-apollo';
import universal from 'react-universal-component';
import ARTICLES_FOR_TAG from '../gql/articlesForTag.graphql';
import type { ArticlesType, MatchParams } from '../../../types/boldr';

const UniversalTagList = universal(import('./TagList'));

type Props = {
  loading: boolean,
  error?: Object,
  getArticlesForTag: ArticlesType,
  match: MatchParams,
};

const TagList = ({ loading, error, match, getArticlesForTag }: Props) =&gt; (
  
);

// $FlowIssue
export default graphql(ARTICLES_FOR_TAG, {
  options: props =&gt; ({
    variables: {
github MorpheoOrg / morpheo-analytics / src / client / js / business / notebook / routes.js View on Github external
* knowledge of the CeCILL license and that you accept its terms.
 */

import React from 'react';
import universal from 'react-universal-component';
import {injectReducer} from 'redux-injector';
import {injectSaga} from 'redux-sagas-injector';
import PulseLoader from '../common/components/presentation/loaders/pulseLoader';
import {connect} from 'react-redux';

import localStorage from '../../../../common/localStorage';

import theme from '../../../css/variables';

// second way with onLoad
const Universal = universal(import('./preload'), {
    loading: <div>Loading notebook...</div>,
    onLoad: (module) =&gt; {
        injectSaga('notebook', module.notebookSagas);
        injectReducer('notebook', module.notebookReducer);
        injectReducer('settings', module.settingsReducer(localStorage));

        // Configure hot module replacement for the reducer
        if (process.env.NODE_ENV !== 'production') {
            if (module.hot) {
                module.hot.accept('./reducers/index', () =&gt; import('./reducers/index').then((module) =&gt; {
                    injectReducer('notebook', module.default);
                }));

                module.hot.accept('../settings/reducer', () =&gt; import('../settings/reducer').then((module) =&gt; {
                    injectReducer('settings', module.default(localStorage));
                }));
github strues / boldr / packages / frontend / src / scenes / Profile / index.js View on Github external
// @flow
import * as React from 'react';
import { graphql } from 'react-apollo';
import universal from 'react-universal-component';
import type { ProfileType } from '../../types/boldr';
import PROFILE_QUERY from './gql/userProfile.graphql';

const UniversalProfile = universal(import('./Profile'));

type Props = {
  loading: boolean,
  error?: Object,
  profile: ProfileType,
};

const Profile = ({ loading, error, profile }: Props) =&gt; (
  
);

// $FlowIssue
export default graphql(PROFILE_QUERY, {
  options: props =&gt; ({
    variables: {
      username: props.match.params.username,
github smartcontractkit / chainlink / operator_ui / src / Private.tsx View on Github external
}
&gt; = universal(import('./pages/Dashboards/Index'), uniOpts)
const JobRunsIndex: UniversalComponent&lt;
  Pick&lt;
    {
      classes: any
    },
    never
  &gt; &amp; {
    pagePath: string
  }
&gt; = universal(import('./pages/JobRuns/Index'), uniOpts)
const JobsIndex = universal(import('./pages/JobsIndex/JobsIndex'), uniOpts)
const JobsShow = universal(import('./pages/Jobs/Show'), uniOpts)
const JobsNew = universal(import('./pages/Jobs/New'), uniOpts)
const BridgesIndex = universal(import('./pages/Bridges/Index'), uniOpts)
const BridgesNew = universal(import('./pages/Bridges/New'), uniOpts)
const BridgesShow = universal(import('./pages/Bridges/Show'), uniOpts)
const BridgesEdit = universal(import('./pages/Bridges/Edit'), uniOpts)
const JobRunsShowOverview = universal(import('./pages/Jobs/Runs/Show'), uniOpts)
const TransactionsIndex = universal(
  import('./pages/Transactions/Index'),
  uniOpts,
)
const TransactionsShow = universal(import('./pages/Transactions/Show'), uniOpts)
const Configuration = universal(import('./pages/Configuration/Index'), uniOpts)
const NotFound = universal(import('./pages/NotFound'), uniOpts)
const KeysIndex = universal(import('./pages/Keys/Index'), uniOpts)

const styles = (theme: Theme) =&gt; {
  return {
    content: {
github smartcontractkit / chainlink / operator_ui / src / Private.tsx View on Github external
recentJobRunsCount: number
      recentlyCreatedPageSize: number
    }
&gt; = universal(import('./pages/Dashboards/Index'), uniOpts)
const JobRunsIndex: UniversalComponent&lt;
  Pick&lt;
    {
      classes: any
    },
    never
  &gt; &amp; {
    pagePath: string
  }
&gt; = universal(import('./pages/JobRuns/Index'), uniOpts)
const JobsIndex = universal(import('./pages/JobsIndex/JobsIndex'), uniOpts)
const JobsShow = universal(import('./pages/Jobs/Show'), uniOpts)
const JobsNew = universal(import('./pages/Jobs/New'), uniOpts)
const BridgesIndex = universal(import('./pages/Bridges/Index'), uniOpts)
const BridgesNew = universal(import('./pages/Bridges/New'), uniOpts)
const BridgesShow = universal(import('./pages/Bridges/Show'), uniOpts)
const BridgesEdit = universal(import('./pages/Bridges/Edit'), uniOpts)
const JobRunsShowOverview = universal(import('./pages/Jobs/Runs/Show'), uniOpts)
const TransactionsIndex = universal(
  import('./pages/Transactions/Index'),
  uniOpts,
)
const TransactionsShow = universal(import('./pages/Transactions/Show'), uniOpts)
const Configuration = universal(import('./pages/Configuration/Index'), uniOpts)
const NotFound = universal(import('./pages/NotFound'), uniOpts)
const KeysIndex = universal(import('./pages/Keys/Index'), uniOpts)

const styles = (theme: Theme) =&gt; {
github dtonys / universal-web-boilerplate / src / components / Page / Page.js View on Github external
ROUTE_REDUX_DEMO,
  ROUTE_USERS,
  ROUTE_USER_DETAIL,
  ROUTE_USER_DETAIL_TAB,
  ROUTE_ADMIN_USERS,
} from 'redux/routesMap';


const options = {
  minDelay: 300,
  loading: Loading,
};
const HomePage = universal(import('pages/Home/Home'), options);
const LoginPage = universal(import('pages/Login/Login'), options);
const SignupPage = universal(import('pages/Signup/Signup'), options);
const NotFoundPage = universal(import('pages/NotFound/NotFound'), options);
const ReduxDemoPage = universal(import('pages/ReduxDemo/ReduxDemo'), options);
const UsersListPage = universal(import('pages/UsersList/UsersList'), options);
const UserDetailPage = universal(import('pages/UserDetail/UserDetail'), options);

const actionToPage = {
  [ROUTE_HOME]: HomePage,
  [ROUTE_LOGIN]: LoginPage,
  [ROUTE_SIGNUP]: SignupPage,
  [ROUTE_REDUX_DEMO]: ReduxDemoPage,
  [ROUTE_USERS]: UsersListPage,
  [ROUTE_USER_DETAIL]: UserDetailPage,
  [ROUTE_USER_DETAIL_TAB]: UserDetailPage,
  [ROUTE_ADMIN_USERS]: UsersListPage,
  [NOT_FOUND]: NotFoundPage,
};
const getPageFromRoute = ( routeAction ) => {
github timkindberg / egghead-universal-component / 08_preload / src / components / App.js View on Github external
import React from 'react'
import universal from 'react-universal-component'

const UniversalTab = universal(({ tab }) =&gt; import(`./${tab}`))

export default class App extends React.Component {
  state = { selected: 'Home' }

  render() {
    return (
      <div>
        

        <button>
            this.setState({ selected: 'Home' }) }&gt;
          Home
        </button>
        <button>
            this.setState({ selected: 'Foo' }) }
                onMouseEnter={ () =&gt;</button></div>

react-universal-component

A higher order component for loading components with promises

MIT
Latest version published 4 years ago

Package Health Score

57 / 100
Full package analysis