actions/index.js
export function actionFunction() {
/*do somethings with data*/
return {
type: 'SAMPLE_ACTION' /*action type name, best from constants folder*/
payload: data /*your data*/
}| const Commentlist = ({comments}) => ( | |
| <ul> | |
| {comments.map(({ body, author }) => | |
| <li>{body}-{author}</li> | |
| )} | |
| </ul> | |
| ) |
| const Greeting = ({ name, ...props }) => | |
| <div {...props}>Hi {name}!</div> |
| const Greeting = ({name}) => <div>Hello {name}!</div> |
| const Greeting = props => <div>Hello {props.name}!</div> |
| <div class="better" data-gorrion="gorrion" data-other="other prop">Gorrion is always bettter</div> |
| <MyBetterDiv data-gorrion="gorrion" data-other="other prop">Gorrion is always bettter</MyBetterDiv> |
| const MyBetterDiv = props => | |
| <div className="better" {...props} /> |
| const MyBetterDiv = props => ( | |
| <div className="better" {...props} /> | |
| ) |