This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {PropTypes} from 'react'; | |
import {connect} from 'react-redux'; | |
import {bindActionCreators} from 'redux'; | |
import * as actionCreators from '../../actions/actionCreators'; | |
import countries from '../../data/countries'; | |
import users from '../../data/users'; | |
import {browserHistory} from 'react-router'; | |
import RegistrationFormStepOne from './registrationFormStepOne'; | |
import RegistrationFormStepTwo from './registrationFormStepTwo'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var React = require('react'); | |
var ReactDOMServer = require('react-dom/server'); | |
var Manna = require('./Manna'); | |
var Cog = require('./Cog'); | |
var build = function(name, props) { | |
var size = props.size || 64; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// connect() is a function that injects Redux-related props into your component. | |
// You can inject data and callbacks that change that data by dispatching actions. | |
function connect(mapStateToProps, mapDispatchToProps) { | |
// It lets us inject component as the last step so people can use it as a decorator. | |
// Generally you don't need to worry about it. | |
return function (WrappedComponent) { | |
// It returns a component | |
return class extends React.Component { | |
render() { | |
return ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//2 Define api , this.refs.dropDown.toggleMenu() | |
const DropDown = React.createClass({ | |
getDefaultProps() { | |
return {initialIsOpen: false, onChange:()=>{}}; | |
}, | |
getInitialState() { | |
//set initial state from props | |
return {isOpen: this.props.initialIsOpen}; | |
}, | |
toggleMenu(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Set initial state from props.isOpen, and modify state from parent component through componentWillReceiveProps | |
import React from 'react'; | |
const DropDown = React.createClass({ | |
getDefaultProps() { | |
return {isOpen: false, onChange:()=>{}}; | |
}, | |
getInitialState() { | |
//set initial state from props | |
return {isOpen: this.props.isOpen}; | |
}, |