Created
August 16, 2016 08:24
-
-
Save yasuhiro-okada-aktsk/5d005efdb4293234c34634a2af04a8fc to your computer and use it in GitHub Desktop.
redux templates
This file contains 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
mport {createAction} from 'redux-actions' | |
import {METHOD_GET, METHOD_POST, METHOD_PUT, createApiMeta} from '../../../common/js/actions/helpers/api'; | |
export const aaaGet = createAction('AAA_GET', | |
() => ( null ), | |
(id) => createApiMeta(`/api/company_branches/${id}`, null, METHOD_GET)); | |
This file contains 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'; | |
export default class Aaa extends React.Component { | |
static propTypes = {}; | |
constructor(...args) { | |
super(...args); | |
} | |
componentDidMount() { | |
} | |
componentDidUpdate(prevProps, prevState) { | |
} | |
componentWillUnmount() { | |
} | |
render() { | |
return ( | |
<div> | |
</div> | |
); | |
} | |
} |
This file contains 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 {defaultMapDispatchToProps} from '../../actions/index'; | |
class AaaPage extends React.Component { | |
static propTypes = {}; | |
constructor(...args) { | |
super(...args); | |
} | |
componentDidMount() { | |
} | |
componentDidUpdate(prevProps, prevState) { | |
} | |
componentWillUnmount() { | |
} | |
render() { | |
return ( | |
<div> | |
</div> | |
); | |
} | |
} | |
function mapStateToProps(state) { | |
return {}; | |
} | |
export default connect( | |
mapStateToProps, | |
defaultMapDispatchToProps, | |
)(AaaPage); |
This file contains 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 {handleActions} from 'redux-actions'; | |
import {clearState} from '../../../common/js/reducers/helper/state'; | |
export const aaas = handleActions({ | |
AAAAS_GET: (state, action) => (action.payload ? [...state, ...action.payload] : state), | |
CLEAR_STATE: clearState('aaas', []), | |
}, []); | |
export const aaa = handleActions({ | |
AAA_GET: (state, action) => (action.payload || state), | |
CLEAR_STATE: clearState('aaa', null), | |
}, null); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment