美文网首页
React 实作笔记

React 实作笔记

作者: sinlight | 来源:发表于2015-07-02 05:19 被阅读128次

服务器端渲染(与客户端渲染共存)

npm i express-react-view
服务器端先渲染整个页面,页面组件中内嵌一个内容组件,由containerElement包裹,其属性通过页面组件的属性间接传入;
为客户端编写入口文件,包含一个导出函数,入参为内容组件的属性值,内部调用React.render(内容组件, containerElement)
页面组件在渲染到客户端后,需执行该函数

html radio group

npm i react-radio-group
使用时发现,与html table有兼容性问题,运行时react会给出警告。给该组件增加了一个prop,containerType,默认值使用原有的div,当在table中使用时,可指定为tbody。

表单验证

npm i react-validation-mixin joi

browserify

  • extensions
    cli: --extensions=.jsx
    api: {extensions: ['.jsx']}
  • transform
    cli: -t [reactify]
    npm config:
    api: {transform: [reactify]}
  • standalone

watchify

遇到只watch入口文件的问题,暂用gulp watch 替代

相关文章

网友评论

      本文标题:React 实作笔记

      本文链接:https://www.haomeiwen.com/subject/zsfyqttx.html