全栈发布应用:从静态到动态数据交互
完成首个静态发布应用
在静态应用里,最后要做的就是渲染从 this.props 传来的文章。借助 Redux,我们能访问在 reducer 中模拟的对象。比如,在 PublishingApp.js 的 render 函数里使用 console.log(this.props) ,就能看到文章对象:
const articleMock = {
'987654': {
articleTitle: 'Lorem ipsum - article one',
articleContent: 'Here goes the content of the article'
},
"123456": {
articleTitle: 'Lorem ipsum - article two',
articleContent: 'Sky is the limit, the content goes here.'
}
};
我们需要修改 React 的 render 函数,在 src/layouts/PublishingApp.js 中:
render () {
let articlesJSX = [
超级会员免费看
订阅专栏 解锁全文
1917

被折叠的 条评论
为什么被折叠?



