How to use hops-react - 7 common examples

To help you get started, we’ve selected a few hops-react 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 xing / hops / demo / src / app.js View on Github external
<h1>Hello World!</h1>
);

const Foo = () =&gt; (
  <h1>Hello Foo!</h1>
);

const App = () =&gt; (
  
);

export default render(, createContext({
  reducers: {
    foo: function (state, action) {
      // console.log(state, action);
      return Object.assign({}, state);
    }
  },
  actionCreators: {
    '/:foo': function (params, location) {
      return function (dispatch) {
        console.log(params, location);
      };
    }
  }
}));
github xing / hops / packages / template-react / src / context.js View on Github external
// @flow
import {
  combineContexts,
  contextDefinition as reactContext
} from 'hops-react';

import {
  contextDefinition as reduxContext
} from 'hops-redux';

import {
  contextDefinition as graphqlContext
} from 'hops-graphql';

export default combineContexts(
  reactContext,
  reduxContext,
  graphqlContext
);
github xing / hops / packages / graphql / node.js View on Github external
},
          ]),
        });
      }.bind(this)
    );
  },
  prefetchData: function(rootElement) {
    return process.env.HOPS_MODE !== 'static'
      ? ReactApollo.getDataFromTree(rootElement)
      : Promise.resolve();
  },
});

exports.contextDefinition = exports.GraphQLContext;

exports.createContext = hopsReact.combineContexts(
  hopsReact.ReactContext,
  exports.GraphQLContext
);

exports.graphqlExtension = function(config) {
  return {
    context: exports.GraphQLContext,
    config: {
      graphql: config,
    },
  };
};
github xing / hops / packages / graphql / dom.js View on Github external
return common.constructor.apply(this, arguments);
};
exports.GraphQLContext.prototype = Object.assign({}, common, {
  createCache: function() {
    return common.createCache
      .call(this)
      .restore(global[constants.APOLLO_STATE]);
  },
  getIntrospectionResult: function() {
    return global[constants.APOLLO_IQRD];
  },
});

exports.contextDefinition = exports.GraphQLContext;

exports.createContext = hopsReact.combineContexts(
  hopsReact.ReactContext,
  exports.GraphQLContext
);

exports.graphqlExtension = function(config) {
  return {
    context: exports.GraphQLContext,
    config: {
      graphql: config,
    },
  };
};
github xing / hops / packages / graphql / dom.js View on Github external
};
exports.GraphQLContext.prototype = Object.assign({}, common, {
  createCache: function() {
    return common.createCache
      .call(this)
      .restore(global[constants.APOLLO_STATE]);
  },
  getIntrospectionResult: function() {
    return global[constants.APOLLO_IQRD];
  },
});

exports.contextDefinition = exports.GraphQLContext;

exports.createContext = hopsReact.combineContexts(
  hopsReact.ReactContext,
  exports.GraphQLContext
);

exports.graphqlExtension = function(config) {
  return {
    context: exports.GraphQLContext,
    config: {
      graphql: config,
    },
  };
};
github xing / hops / packages / graphql / node.js View on Github external
]),
        });
      }.bind(this)
    );
  },
  prefetchData: function(rootElement) {
    return process.env.HOPS_MODE !== 'static'
      ? ReactApollo.getDataFromTree(rootElement)
      : Promise.resolve();
  },
});

exports.contextDefinition = exports.GraphQLContext;

exports.createContext = hopsReact.combineContexts(
  hopsReact.ReactContext,
  exports.GraphQLContext
);

exports.graphqlExtension = function(config) {
  return {
    context: exports.GraphQLContext,
    config: {
      graphql: config,
    },
  };
};
github xing / hops / packages / spec / fixtures / integration / main.js View on Github external
import React from 'react';
import { Switch, Route } from 'react-router-dom';
import { Miss, render, createContext } from 'hops-react';

import { headline } from './style.css';

const Home = () =&gt; <h1>Hello World!</h1>;

const App = () =&gt; (
  
);

export default render(, createContext());

hops-react

React and ReactRouter setup for Hops

MIT
Latest version published 2 years ago

Package Health Score

57 / 100
Full package analysis