How to use the react-on-rails.getStore function in react-on-rails

To help you get started, we’ve selected a few react-on-rails 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 shakacode / react_on_rails / spec / dummy / client / app / startup / ClientReduxSharedStoreApp.jsx View on Github external
export default (props, _railsContext, domNodeId) => {
  const render = props.prerender ? ReactDOM.hydrate : ReactDOM.render;
  // eslint-disable-next-line no-param-reassign
  delete props.prerender;

  // This is where we get the existing store.
  const store = ReactOnRails.getStore('SharedReduxStore');

  // renderApp is a function required for hot reloading. see
  // https://github.com/retroalgic/react-on-rails-hot-minimal/blob/master/client/src/entry.js

  // Provider uses this.props.children, so we're not typical React syntax.
  // This allows redux to add additional props to the HelloWorldContainer.
  const renderApp = (Komponent) => {
    const element = (
      
        
          
        
      
    );
    render(element, document.getElementById(domNodeId));
  };
github Limenius / symfony-react-sandbox / assets / js / recipes-redux / startup / RecipesApp.js View on Github external
const mainNode = (_initialProps, context) => {
  const store = ReactOnRails.getStore("recipesStore");
  const { location, base, serverSide } = context;

  // We render a different router depending on whether we are rendering server side
  // or client side.
  let Router;
  if (serverSide) {
    Router = props => (
      
        {props.children}
      
    );
  } else {
    Router = props => (
      {props.children}
    );
  }
github shakacode / react-webpack-rails-tutorial / client / app / bundles / comments / startup / ServerRouterApp.jsx View on Github external
export default (_props, railsContext) => {
  const store = ReactOnRails.getStore('routerCommentsStore');

  let error;
  let redirectLocation;
  const { location } = railsContext;

  // This tell react_on_rails to skip server rendering any HTML. Note, client rendering
  // will handle the redirect. What's key is that we don't try to render.
  // Critical to return the Object properties to match this { error, redirectLocation }
  if (error || redirectLocation) {
    return { error, redirectLocation };
  }

  // Allows components to add properties to the object to store
  // information about the render.
  const context = {};
github shakacode / react_on_rails / spec / dummy_no_webpacker / client / app / startup / ClientReduxSharedStoreApp.jsx View on Github external
export default (props, railsContext, domNodeId) => {
  // This is where we get the existing store.
  const store = ReactOnRails.getStore('SharedReduxStore');

  // renderApp is a function required for hot reloading. see
  // https://github.com/retroalgic/react-on-rails-hot-minimal/blob/master/client/src/entry.js

  // Provider uses this.props.children, so we're not typical React syntax.
  // This allows redux to add additional props to the HelloWorldContainer.
  const renderApp = (Komponent) => {
    const element = (
      
        
          
        
      
    )
    render(element, document.getElementById(domNodeId));
  }
github shakacode / react-webpack-rails-tutorial / client / app / bundles / comments / startup / NavigationBarApp.jsx View on Github external
export default (_props, railsContext) => {
  // This is where we get the existing store.
  const { pathname } = railsContext;
  let store;
  if (pathname === paths.ROUTER_PATH) {
    store = ReactOnRails.getStore('routerCommentsStore', false);
  } else if (pathname === paths.NO_ROUTER_PATH) {
    store = ReactOnRails.getStore('commentsStore', false);
  } else {
    return (
      
    );
  }

  return (
    
      
    
  );
};
github shakacode / react-webpack-rails-tutorial / client / app / bundles / comments / startup / NavigationBarApp.jsx View on Github external
export default (_props, railsContext) => {
  // This is where we get the existing store.
  const { pathname } = railsContext;
  let store;
  if (pathname === paths.ROUTER_PATH) {
    store = ReactOnRails.getStore('routerCommentsStore', false);
  } else if (pathname === paths.NO_ROUTER_PATH) {
    store = ReactOnRails.getStore('commentsStore', false);
  } else {
    return (
      
    );
  }

  return (
    
      
    
  );
};
github shakacode / react-webpack-rails-tutorial / client / app / bundles / comments / startup / ClientRouterApp.jsx View on Github external
export default (_props, _railsContext) => {
  const store = ReactOnRails.getStore('routerCommentsStore');

  return (
    
      
        {routes}
      
    
  );
};
github shakacode / react-webpack-rails-tutorial / client / app / bundles / comments / startup / App.jsx View on Github external
export default (_props, _railsContext) => {
  const store = ReactOnRails.getStore('commentsStore');

  return (
    
      
    
  );
};
github Limenius / symfony-react-sandbox / client / js / recipes-redux / startup / RecipesAppServer.js View on Github external
const mainNode = (_initialProps, context) => {
    const store = ReactOnRails.getStore('recipesStore')

    const { location, base } = context

    const reactComponent = (
        
            
                
            
        
    )
    return reactComponent
}
github Limenius / symfony-react-sandbox / assets / js / liform / startup / Admin.js View on Github external
const mainNode = () => {
  const store = ReactOnRails.getStore("recipesAdminStore");

  return (
    
      
    
  );
};

react-on-rails

react-on-rails JavaScript for react_on_rails Ruby gem

MIT
Latest version published 3 months ago

Package Health Score

89 / 100
Full package analysis