Giter Club home page Giter Club logo

fb-reactor's Introduction

FB Reactor for React JS

A simple, super fast scaffolding tool for Facebook's React JS framework. Within seconds you can create a full React project structure with stubbed out component files.

Install

Good old npm:

npm install -g fbreactor

CLI Usage:

Create new reactorfile

All configuration is driven off of reactorfile.js. This is kept in your project root directory and specifies settings like the source root for React framework.

fbreactor create reactorfile

This creates a standard reactorfile with your React source directory at /src.

fbreactor create reactorfile --basedir /app

Creates a reactorfile with /app as your Reactor root.

Create React framework structure

Use create framework to build the initial structure for React components.

fbreactor create framework

If you are using a standard reactorfile, this will result in the following directories being created:

  • /src
    • /components
    • /stores
    • /actions
    • /libs
    • /mixins

If you have specified something different for you React root then src will be replaced with that.

Creating new components

This is comething you'll be doing for the life of the project. Whenever you need a completely new component in React, it requires creating many files and a ton of copy/paste/remove. Not anymore!

fbreactor create component --name MyThing

This will create a new Component, Store, Action, and Lib for your component called MyThing.

  • /src
    • /components
      • my_thing.jsx
    • /stores
      • my_thing.js
    • /actions
      • my_thing.js
    • /libs
      • my_thing.js
    • /mixins

Generated component my_thing.jsx

/** @jsx React.DOM */
var React = require('react'),
    Fluxxor = require('fluxxor'),
    FluxChildMixin = Fluxxor.FluxMixin(React),
    StoreWatchMixin = Fluxxor.StoreWatchMixin;

var MyThingComponent = React.createClass({

    mixins: [FluxChildMixin, StoreWatchMixin("MyThingStore")],

    getInitialState: function() {
        return {};
    },

    getStateFromFlux: function() {
        return {
            MyThingStore: flux.store("MyThingStore").getState()
        };
    },

    render: function() {
        return (
            <div>Nothing here yet...</div>
        );
    }
});

module.exports = MyThingComponent;

fb-reactor's People

Contributors

haggy avatar

Watchers

 avatar  avatar

fb-reactor's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.