vueact/babel-plugin-transform-react-to-vue

propTypes not transformed to vue

Opened this issue · 1 comments

https://goo.gl/Wq1fxi

example:

import React from 'react';

class Display extends React.Component {
  render() {
    return (
      <div className="component-display">
        <div>
          {this.props.value}
        </div>
      </div>
    );
  }
}
Display.propTypes = {
  value: React.PropTypes.string,
};
export default Display;

propTypes can be used to make 2 thinks in react:

  1. events in vue
  2. props in vue

we can determine this based on value of property if its React.PropTypes.func than this is an $emit

Hmm, looks possible with ComponentName.propTypes = {} and static propTypes = {}... I think we can use that as props index and use this.$props instead of this.$attrs, what do you think @egoist?

P.S. using on* for events is what I'd like to do since in Vue JSX this is the delimiter between event and prop so if you pass a prop like myCallback={(data) => console.log(data)} it will be a prop instead of event.