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

Detect render props smartly

Opened this issue · 0 comments

Hello, first of all thanks for such an awesome transformer!

Currently a component which looks like that gets transpiled into a naive this.$attrs.renderProp(this.$data) call, which of course is not correct. The best way would be to take advantage of scoped slots.

import React from 'react'

class Mouse extends React.Component {
  render() {
    return (
      <div>
        {this.props.renderProp(this.state)}
      </div>
    )
  }
}

A description of render props in React can be found here and a real world usage of scoped lots in Vue can be found here.

Thanks for considering that!