Skip to content

Stateless React boilerplate with altjs, sass, webpack, webpack-dev-server, eslint, enzyme, chai, sinon and storybook

Notifications You must be signed in to change notification settings

agutoli/react-simple-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instalation

npm install

Running

npm start

Flux/Alt example

Actions

import { Actions } from 'decorators/altDecorators';

@Actions
class ArticleActions {
  constructor() {
    this.generateActions('dataLoader');
  }
}

export default ArticleActions;

Store

import ArticleActions from 'actions/ArticleActions';
import ArticleService from 'business/ArticleService';

import { Store } from 'decorators/altDecorators';
import { ArticleEntityCollection } from 'business/ArticleEntity';

@Store(ArticleActions)
class ArticleStore {

  articles = new ArticleEntityCollection([]);

  dataLoader() {
    ArticleService.fetch().then(articles => {
      this.setState({ articles: new ArticleEntityCollection(articles) });
    });
  }
}

export default ArticleStore;

Connect your stores with components

import ArticleStore from 'stores/ArticleStore';
import ArticleActions from 'actions/ArticleActions';
import { StoreContainer } from 'decorators/altDecorators';

import Articles from './Articles';

export default StoreContainer(ArticleStore)(Articles, {
  componentWillMount() {
    ArticleActions.dataLoader();
  }
});

About

Stateless React boilerplate with altjs, sass, webpack, webpack-dev-server, eslint, enzyme, chai, sinon and storybook

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published