@canner/canner-hoc

1.2.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @canner/canner-hoc

Weekly Downloads

3

Version

1.2.0

License

Apache-2.0

Last publish

Collaborators

  • wwwy3y3
  • cannerbot