Giter Club home page Giter Club logo

Comments (8)

MoOx avatar MoOx commented on June 21, 2024 1

No rush, I was just reporting :)

from babel-plugin-flow-react-proptypes.

brigand avatar brigand commented on June 21, 2024 1

Fixed, thanks for reporting and trying out the plugin :-)

from babel-plugin-flow-react-proptypes.

brigand avatar brigand commented on June 21, 2024

I'm not getting an error on that code snippet. Are you getting an error with that exact code?

$ babel --presets react,stage-1,es2015 --plugins ./lib/index.js < src/__test__/fixtures/functional-component.input.js
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _react = require("react");

var _react2 = _interopRequireDefault(_react);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ReactFunctionalComponent = function ReactFunctionalComponent(props) {
  return _react2.default.createElement(
    "div",
    null,
    props.param
  );
};

exports.default = ReactFunctionalComponent;

from babel-plugin-flow-react-proptypes.

MoOx avatar MoOx commented on June 21, 2024

yeah. Oh so maybe related to the fact that I use babel-eslint?

from babel-plugin-flow-react-proptypes.

MoOx avatar MoOx commented on June 21, 2024

Oh my bad, I am getting this with my test class

/* @flow */

import React, { Element, Component } from "react"

type Props = {
  onMount?: () => void,
}

type State = {
  clicked: boolean,
}

class ReactClassComponent extends Component<void, Props, State> {
  state: State = {
    clicked: false,
  };

  constructor(props: Props) {
    super(props)
  }

  componentDidMount() {
    if (this.props.onMount) {
      this.props.onMount()
    }
  }

  handleClick: () => void = () => {
    this.setState({ clicked: true })
  };

  render(): Element {
    return (
      <div onClick={ this.handleClick }>
        {
          !this.state.clicked
          ? "Hi"
          : "Hey"
        }
      </div>
    )
  }
}

export default ReactClassComponent

from babel-plugin-flow-react-proptypes.

brigand avatar brigand commented on June 21, 2024

I see the issue. It's the onMount?: () => void,. I'm not handling function type annotations.

I'll have it fixed in a few hours.

from babel-plugin-flow-react-proptypes.

glortho avatar glortho commented on June 21, 2024

What are the prospects for supporting functional components?

from babel-plugin-flow-react-proptypes.

brigand avatar brigand commented on June 21, 2024

@glortho moved it to a standalone issue #11.

from babel-plugin-flow-react-proptypes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.