Skip to content

Detect render props smartly #18

Open
@andreiglingeanu

Description

@andreiglingeanu

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions