Skip to content

Commit ee7bb67

Browse files
authored
Merge pull request #27 from lumihq/michael/fix-displayname
Fix `displayName` and name lifecycle functions
2 parents 0902596 + 6d24efe commit ee7bb67

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

examples/controlled-input/src/ControlledInput.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import React.Basic.DOM.Events as Events
1010

1111
component :: ReactComponent {}
1212
component = react
13-
{ displayName: "Counter"
13+
{ displayName: "ControlledInput"
1414
, initialState: { value: "hello world", timeStamp: Nothing }
1515
, receiveProps: \_ _ _ -> pure unit
1616
, render: \_ state setState ->

src/React/Basic.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ var React = require("react");
44
var Fragment = React.Fragment || "div";
55

66
exports.component_ = function(spec) {
7-
function Component(props) {
7+
var Component = function constructor(props) {
88
this.state = spec.initialState;
99
return this;
10-
}
10+
};
11+
1112
Component.prototype = Object.create(React.Component.prototype);
1213

13-
Component.prototype.displayName = spec.displayName;
14+
Component.displayName = spec.displayName;
1415

15-
Component.prototype.componentDidMount = function() {
16+
Component.prototype.componentDidMount = function componentDidMount() {
1617
var this_ = this;
1718
spec.receiveProps(this.props, this.state, function(newState) {
1819
return function() {
@@ -21,7 +22,9 @@ exports.component_ = function(spec) {
2122
});
2223
};
2324

24-
Component.prototype.componentWillReceiveProps = function(newProps) {
25+
Component.prototype.componentWillReceiveProps = function componentWillReceiveProps(
26+
newProps
27+
) {
2528
var this_ = this;
2629
spec.receiveProps(newProps, this.state, function(newState) {
2730
return function() {
@@ -30,7 +33,7 @@ exports.component_ = function(spec) {
3033
});
3134
};
3235

33-
Component.prototype.render = function() {
36+
Component.prototype.render = function render() {
3437
var this_ = this;
3538
return spec.render(this.props, this.state, function(newState) {
3639
return function() {

0 commit comments

Comments
 (0)