@canner/canner-hoc
v1.2.0
Published
canner hoc
Downloads
66
Readme
canner-hoc
About
放置render-server的hoc, 和方便section開發使用的hoc
開發會用到的HOC
- withDataSchema: 定義qa跟預設data
render-server的hoc
- connectHOC: 把section用connect包起來return
- connectMatchHOC: 一樣是包connect, 但是給Match使用
- matchHOC: 包match
- ppHOC: props proxy HOC, 單純把參數傳到section的HOC
Installation
$ npm install --save @canner/canner-hoc
Usage
import {withDataSchema} from '@canner/canner-hoc';
const component = ({title}) => {
return <div>{title}</div>
};
export default withDataSchema({
title: schema().rawData({
qa: {
description: "標題",
type: 'string'
},
data: "預設標題文字"
})
})(component);
build
webpack build兩個file
- VAR js: dist/canner-hoc.js
- min VAR js: dist/canner-hoc.min.js
$ npm run build
publish to s3
版本號會是package.json的version, 會把dist/canner-hoc.min.js傳到s3
ex: 版本為1.0.0
, 傳上去為 https://s3-ap-northeast-1.amazonaws.com/static.canner.io/cannerHoc/1.0.0.min.js
$ npm run s3