react.js:3640 Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `UserList`. See https://fb.me/re

react.js:3640 Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of UserList. See https://fb.me/react-warning-keys for more information.
in h3 (created by UserList)
in UserList

加上 key , 如下:

render: function () {
            var createItem = function (u) {
                return (<h3 key={'li_' + u.id}> {u.username + ':' + JSON.stringify(u.roles)}</h3>);
            }
            return (
                    <ul>
                        {this.state.users.map(createItem)}
                    </ul>
            );
        }
上一篇:bootstrap-table 前端分页,刷新事件代码实例


下一篇:我的生命该如何度过?