diff --git a/docs/react/practical-projects.en-US.md b/docs/react/practical-projects.en-US.md index c9fc41c705..d153ae2866 100644 --- a/docs/react/practical-projects.en-US.md +++ b/docs/react/practical-projects.en-US.md @@ -75,11 +75,9 @@ Create a route component `routes/Products.js`: ```javascript import React from 'react'; -const Products = (props) => { - return ( -

List of Products

- ); -}; +const Products = (props) => ( +

List of Products

+); export default Products; ``` @@ -107,22 +105,19 @@ import React, { PropTypes } from 'react'; import { Table, Popconfirm, Button } from 'antd'; const ProductList = ({ onDelete, products }) => { - const columns = [ - { - title: 'Name', - dataIndex: 'name', + const columns = [{ + title: 'Name', + dataIndex: 'name', + }, { + title: 'Actions', + render: (text, record) => { + return ( + onDelete(record.id)}> + + + ); }, - { - title: 'Actions', - render(text, record) { - return ( - - - - ); - }, - }, - ]; + }]; return ( { - +const Products = ({ dispatch, products }) => { function handleDelete(id) { - props.dispatch({ + dispatch({ type: 'products/delete', payload: id, }); } - return (

List of Products

- +
); }; // export default Products; export default connect(({ products }) => ({ - products + products, }))(Products); ``` @@ -266,7 +259,7 @@ We have completed a simple application, but you may still have lots of questions You can: -- Visit [dva offical website](https://github.com/dvajs/dva) -- View all the [API](https://github.com/dvajs/dva#api) -- View [toturial](https://github.com/dvajs/dva-docs/blob/master/v1/zh-cn/tutorial/01-%E6%A6%82%E8%A6%81.md), complete a medium application step by step -- View examples, such as [dva version of hackernews](https://github.com/dvajs/dva-hackernews) +- Visit [dva offical website](https://github.com/dvajs/dva). +- View all the [API](https://github.com/dvajs/dva#api). +- View [toturial](https://github.com/dvajs/dva-docs/blob/master/v1/zh-cn/tutorial/01-%E6%A6%82%E8%A6%81.md), complete a medium application step by step. +- View examples, such as [dva version of hackernews](https://github.com/dvajs/dva-hackernews). diff --git a/docs/react/practical-projects.zh-CN.md b/docs/react/practical-projects.zh-CN.md index 2f05dea155..9b94b45f66 100644 --- a/docs/react/practical-projects.zh-CN.md +++ b/docs/react/practical-projects.zh-CN.md @@ -75,11 +75,9 @@ $ npm install antd babel-plugin-import --save ```javascript import React from 'react'; -const Products = (props) => { - return ( -

List of Products

- ); -}; +const Products = (props) => ( +

List of Products

+); export default Products; ``` @@ -107,22 +105,19 @@ import React, { PropTypes } from 'react'; import { Table, Popconfirm, Button } from 'antd'; const ProductList = ({ onDelete, products }) => { - const columns = [ - { - title: 'Name', - dataIndex: 'name', + const columns = [{ + title: 'Name', + dataIndex: 'name', + }, { + title: 'Actions', + render: (text, record) => { + return ( + onDelete(record.id)}> + + + ); }, - { - title: 'Actions', - render(text, record) { - return ( - - - - ); - }, - }, - ]; + }]; return (
{ - +const Products = ({ dispatch, products }) => { function handleDelete(id) { - props.dispatch({ + dispatch({ type: 'products/delete', payload: id, }); } - return (

List of Products

- +
); }; // export default Products; export default connect(({ products }) => ({ - products + products, }))(Products); ``` @@ -266,7 +259,7 @@ Child 你可以: -- 访问 [dva 官网](https://github.com/dvajs/dva) -- 查看所有 [API](https://github.com/dvajs/dva#api) -- [教程](https://github.com/dvajs/dva-docs/blob/master/v1/zh-cn/tutorial/01-%E6%A6%82%E8%A6%81.md),一步步完成一个中型应用 -- 看看 [dva 版 hackernews](https://github.com/dvajs/dva-hackernews) 是[如何实现](https://github.com/sorrycc/blog/issues/9)的 +- 访问 [dva 官网](https://github.com/dvajs/dva)。 +- 查看所有 [API](https://github.com/dvajs/dva#api)。 +- [教程](https://github.com/dvajs/dva-docs/blob/master/v1/zh-cn/tutorial/01-%E6%A6%82%E8%A6%81.md),一步步完成一个中型应用。 +- 看看 [dva 版 hackernews](https://github.com/dvajs/dva-hackernews) 是 [如何实现](https://github.com/sorrycc/blog/issues/9) 的。