0.3.8 • Published 3 years ago

high-order-react v0.3.8

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

Developing react with AOP

install

yarn add high-order-react

or

npm i --save-dev high-order-react

import {
  componentDidMount,
  initialState,
  computedProps,
  injectState,
  defaultProps
} from "high-order-react";

interface ownState {
  age: number;
}

interface ownProps {
  height: number;
  long: number;
  total?: number
}

@componentDidMount(({ age }) => {
  console.log(age);
})
@computedProps({ total: ({ height, long }) => height + long })
@defaultProps({
  height:10,
  long:10
})
@initialState({
  age: 1,
})
class App extends Component<ownProps, ownState> {

  @injectState(true);
  showTime(state?: ownState,props?: ownProps) {
    return state.age + props.total
  }

  render() {
    return <h1>wow!{this.showTime()}</h1>; // wow! 21
  }
}

docs

0.3.8

3 years ago

0.3.7

3 years ago

0.3.6

3 years ago

0.3.5

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago