How to use fluxible-addons-react - 10 common examples

To help you get started, we’ve selected a few fluxible-addons-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 MadeInHaus / react-flux-gulp-starter / src / javascript / client.js View on Github external
app.rehydrate(window.App, (err, context) => {
    let isRehydrating = true;

    if (err) {
        throw err;
    }

    debug('React Rendering');

    const RouterWithContext = provideContext(Router, app.customContexts);

    ReactDOM.hydrate(
         {
                        /* emit an event? */
                    })
                    .catch(fetchDataErr => {
                        console.error(fetchDataErr.stack);
github numenta / numenta-apps / unicorn / app / browser / components / ModelList.jsx View on Github external
// http://numenta.org/licenses/

import connectToStores from 'fluxible-addons-react/connectToStores';
import IconCheckbox from 'material-ui/lib/svg-icons/toggle/check-box';
import Paper from 'material-ui/lib/paper';
import React from 'react';
import ReactDOM from 'react-dom';

import Model from './Model';
import ModelStore from '../stores/ModelStore';


/**
 * List of Model Charts, React component
 */
@connectToStores([ModelStore], (context) => ({
  models: context.getStore(ModelStore).getModels(),
  visibleModelStack: context.getStore(ModelStore).getVisibleModelStack()
}))
export default class ModelList extends React.Component {

  static get contextTypes() {
    return {
      executeAction: React.PropTypes.func,
      getConfigClient: React.PropTypes.func,
      getStore: React.PropTypes.func,
      muiTheme: React.PropTypes.object
    };
  }

  static get propTypes() {
    return {
github yahoo / fluxible / packages / generator-fluxible / app / templates / server.js View on Github external
}, (err) => {
        if (err) {
            if (err.statusCode && err.statusCode === 404) {
                // Pass through to next middleware
                next();
            } else {
                next(err);
            }
            return;
        }

        debug('Exposing context state');
        const exposed = 'window.App=' + serialize(app.dehydrate(context)) + ';';

        debug('Rendering Application component into html');
        const markup = ReactDOM.renderToString(createElementWithContext(context));
        const htmlElement = React.createElement(HtmlComponent, {
            clientFile: env === 'production' ? 'main.min.js' : 'main.js',
            context: context.getComponentContext(),
            state: exposed,
            markup: markup
        });
        const html = ReactDOM.renderToStaticMarkup(htmlElement);

        debug('Sending markup');
        res.type('html');
        res.write('' + html);
        res.end();
    });
});
github gpbl / isomorphic500 / src / containers / Html.js View on Github external
if (process.env.NODE_ENV === "production") {
  // on production, include scripts and css from the webpack stats
  const config = require("../../webpack/prod.config");
  const stats = require("../../static/dist/stats.json");
  scripts.push(`${config.output.publicPath}${stats.main}`);
  css.push(`${config.output.publicPath}${stats.css}`);
}
else {
  // on development, use the webpack dev server config
  // css are not needed since they are injected inline with webpack
  const config = require("../../webpack/dev.config");
  scripts.push(`${config.output.publicPath}${config.output.filename}`);
}


@provideContext()
@connectToStores([], context => {
  const htmlHeadStore = context.getStore("HtmlHeadStore");
  return {
    title: htmlHeadStore.getTitle(),
    description: htmlHeadStore.getDescription(),
    siteName: htmlHeadStore.getSiteName(),
    currentUrl: htmlHeadStore.getCurrentUrl(),
    images: htmlHeadStore.getImages()
  };
})
class Html extends React.Component {

  static propTypes = {
    context: PropTypes.object.isRequired,
    lang: PropTypes.string.isRequired,
    state: PropTypes.string.isRequired,
github numenta / numenta-apps / unicorn / js / browser / components / Main.jsx View on Github external
// internals

import FileAddAction from '../actions/FileAdd';
import FileUploadAction from '../actions/FileUpload';
import FileList from '../components/FileList';
import FileDetails from '../components/FileDetails';
import LeftNav from '../components/LeftNav';
import ModelList from '../components/ModelList';
import UnicornTheme from '../lib/MaterialUI/UnicornTheme';


/**
 * React Main View Component
 */
@provideContext({
  getConfigClient: React.PropTypes.func,
  getLoggerClient: React.PropTypes.func,
  getDatabaseClient: React.PropTypes.func,
  getFileClient: React.PropTypes.func,
  getModelClient: React.PropTypes.func
})
@ThemeDecorator(ThemeManager.getMuiTheme(UnicornTheme)) // eslint-disable-line new-cap
export default class Main extends React.Component {

  static get contextTypes() {
    return {
      executeAction: React.PropTypes.func.isRequired
    };
  }

  constructor(props, context) {
github numenta / numenta-apps / unicorn / app / browser / components / Main.jsx View on Github external
import FileValidateAction from '../actions/FileValidate';
import FileList from './FileList';
import FileDetails from './FileDetails';
import HTMStudioTheme from '../lib/MaterialUI/HTMStudioTheme';
import LeftNav from './LeftNav';
import ModelList from './ModelList';

const app = remote.app;
const dialog = remote.require('dialog');


/**
 * React Main View Component
 */
@provideContext({
  getConfigClient: React.PropTypes.func,
  getLogger: React.PropTypes.func,
  getDatabaseClient: React.PropTypes.func,
  getFileClient: React.PropTypes.func,
  getGATracker: React.PropTypes.func,
  getModelClient: React.PropTypes.func,
  getParamFinderClient: React.PropTypes.func
})
@ThemeDecorator(ThemeManager.getMuiTheme(HTMStudioTheme)) // eslint-disable-line new-cap
export default class Main extends React.Component {

  static get contextTypes() {
    return {
      executeAction: React.PropTypes.func.isRequired,
      getParamFinderClient: React.PropTypes.func,
      getConfigClient: React.PropTypes.func,
github slidewiki / slidewiki-platform / test / unit / ContentModulesStore.js View on Github external
beforeEach('render and locate element', function(done){

    let testStores = [ContentModuleStore];
    let context = createMockComponentContext({
      stores : testStores
    });

    let testComponent = provideContext(connectToStores(component, testStores, function(){
      return {};
    }));

    component = TestUtils.renderIntoDocument();

    done();

  });
github quran / quran.com-frontend / tests / unit / components / header / SearchInput.spec.js View on Github external
beforeEach(function() {
    context = createMockComponentContext({});
    sinon.stub(context, 'executeAction');

    var SearchInputClass = provideContext(SearchInput);

    component = ReactTestUtils.renderIntoDocument(
      
    );

    node = ReactDOM.findDOMNode(component);
  });
github quran / quran.com-frontend / tests / unit / components / Pagination.spec.js View on Github external
makeComponent = function(page) {
      var currentRoute = Immutable.Map({
        path: 'http:localhost:8000',
        query: Immutable.Map({q: 'light', p: page || 1})
      });

      var context = createMockComponentContext({
        stores: [RouteStore]
      });

      context.dispatcherContext.dispatcher.stores.RouteStore.prototype.getCurrentRoute = function() {
        return currentRoute;
      }

      var PaginationClass = provideContext(Pagination);

      component = ReactTestUtils.renderIntoDocument(
        
      );

      node = ReactDOM.findDOMNode(component);
    }
  });
github quran / quran.com-frontend / tests / unit / components / audioplayer / Audioplayer.spec.js View on Github external
beforeEach(function() {
    clock = sinon.useFakeTimers();

    context = createMockComponentContext({
      stores: [AudioplayerStore, SurahsStore, AyahsStore]
    });

    context.getStore('SurahsStore').surahs = getSurahs;
    context.getStore('AyahsStore').ayahs = getAyahs;
    context.getStore('AudioplayerStore').currentAyah = getAyahs[0];
    context.getStore('AudioplayerStore').currentAudio = new AudioStub(getAyahs[0].audio.mp3.url);

    var AudioplayerClass = provideContext(Audioplayer);

    component = ReactTestUtils.renderIntoDocument(
      
    );

    node = ReactDOM.findDOMNode(component);

    foundComponent = ReactTestUtils.findAllInRenderedTree(component, function(t) {
      return t.constructor.name === 'Audioplayer';
    })[0];

    sinon.stub(context, 'executeAction');
    sinon.stub(foundComponent, 'changeAyah');
    sinon.stub(foundComponent, 'loadRestOfAudio');
  });

fluxible-addons-react

Fluxible addons for use with React

BSD-3-Clause
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis

Similar packages