64 lines
1.1 KiB
Plaintext
64 lines
1.1 KiB
Plaintext
// - Import react components
|
|
import React, {Component} from 'react'
|
|
|
|
|
|
// - Import components
|
|
|
|
// - Import actions
|
|
|
|
// - Create component class
|
|
export default class {component name} extends Component {
|
|
|
|
/**
|
|
* Component constructor
|
|
* @param {object} props is an object properties of component
|
|
*/
|
|
constructor(props){
|
|
super(props)
|
|
|
|
// Default state
|
|
this.state = {
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Reneder component DOM
|
|
* @return {react element} return the DOM which rendered by component
|
|
*/
|
|
render(){
|
|
return(
|
|
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* Map dispatch to props
|
|
* @param {func} dispatch is the function to dispatch action to reducers
|
|
* @param {object} ownProps is the props belong to component
|
|
* @return {object} props of component
|
|
*/
|
|
const mapDispatchToProps = (dispatch,ownProps) => {
|
|
return{
|
|
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Map state to props
|
|
* @param {object} state is the obeject from redux store
|
|
* @param {object} ownProps is the props belong to component
|
|
* @return {object} props of component
|
|
*/
|
|
const mapStateToProps = (state,ownProps) => {
|
|
return{
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// - Connect component to redux store
|
|
export default connect(mapStateToProps,mapDispatchToProps)(Sidebar)
|