Skip to content

Instantly share code, notes, and snippets.

@peterpme
Last active October 26, 2018 16:38
Show Gist options
  • Save peterpme/55a34244d12209423e1afbee90093ec3 to your computer and use it in GitHub Desktop.
Save peterpme/55a34244d12209423e1afbee90093ec3 to your computer and use it in GitHub Desktop.
Using match_, match in Reason Bug. `Broken-` prefix console.log(match) = undefined
// Generated by BUCKLESCRIPT VERSION 4.0.5, PLEASE EDIT WITH CARE
import * as React from 'react'
import * as ReasonReact from 'reason-react/src/ReasonReact.js'
require('./Navigator.css')
var component = ReasonReact.statelessComponent('Navigator')
function make(history, match__, _) {
return /* record */ [
/* debugName */ component[/* debugName */ 0],
/* reactClassInternal */ component[/* reactClassInternal */ 1],
/* handedOffState */ component[/* handedOffState */ 2],
/* willReceiveProps */ component[/* willReceiveProps */ 3],
/* didMount */ component[/* didMount */ 4],
/* didUpdate */ component[/* didUpdate */ 5],
/* willUnmount */ component[/* willUnmount */ 6],
/* willUpdate */ component[/* willUpdate */ 7],
/* shouldUpdate */ component[/* shouldUpdate */ 8],
/* render */ function() {
console.log('history', history)
console.log('match', match__)
return React.createElement('div', undefined)
},
/* initialState */ component[/* initialState */ 10],
/* retainedProps */ component[/* retainedProps */ 11],
/* reducer */ component[/* reducer */ 12],
/* jsElementWrapped */ component[/* jsElementWrapped */ 13]
]
}
var $$default = ReasonReact.wrapReasonForJs(component, function(jsProps) {
return make(jsProps.history, jsProps.match_, /* array */ [])
})
export { component, make, $$default, $$default as default }
/* Not a pure module */
[%bs.raw {|require('./Navigator.css')|}];
let component = ReasonReact.statelessComponent("Navigator");
type action =
| Navigate(string)
| Logout;
let make = (~history, ~match_, _children) => {
...component,
render: _self => {
Js.log2("history", history);
Js.log2("match", match_); // undefined
<div />
},
};
let default =
ReasonReact.wrapReasonForJs(~component, jsProps =>
make(~match_=jsProps##match, ~history=jsProps##history, [||])
);
import React from "react";
import { withRouter } from "react-router-dom";
import Navigator from "./Navigator.bs";
const Parent = ({ match, history }) => <Navigator match={match} history={history} />;
export default Parent;
// Generated by BUCKLESCRIPT VERSION 4.0.5, PLEASE EDIT WITH CARE
import * as React from 'react'
import * as ReasonReact from 'reason-react/src/ReasonReact.js'
require('./Navigator.css')
var component = ReasonReact.statelessComponent('Navigator')
function make(history, match__, _) {
return /* record */ [
/* debugName */ component[/* debugName */ 0],
/* reactClassInternal */ component[/* reactClassInternal */ 1],
/* handedOffState */ component[/* handedOffState */ 2],
/* willReceiveProps */ component[/* willReceiveProps */ 3],
/* didMount */ component[/* didMount */ 4],
/* didUpdate */ component[/* didUpdate */ 5],
/* willUnmount */ component[/* willUnmount */ 6],
/* willUpdate */ component[/* willUpdate */ 7],
/* shouldUpdate */ component[/* shouldUpdate */ 8],
/* render */ function() {
console.log('history', history)
console.log('match', match__)
return React.createElement('div', undefined)
},
/* initialState */ component[/* initialState */ 10],
/* retainedProps */ component[/* retainedProps */ 11],
/* reducer */ component[/* reducer */ 12],
/* jsElementWrapped */ component[/* jsElementWrapped */ 13]
]
}
var $$default = ReasonReact.wrapReasonForJs(component, function(jsProps) {
return make(jsProps.history, jsProps.match_, /* array */ [])
})
export { component, make, $$default, $$default as default }
/* Not a pure module */
[%bs.raw {|require('./Navigator.css')|}];
let component = ReasonReact.statelessComponent("Navigator");
type action =
| Navigate(string)
| Logout;
let make = (~history, ~match_, _children) => {
...component,
render: _self => {
Js.log2("history", history);
Js.log2("match", match_);
<div />
},
};
let default =
ReasonReact.wrapReasonForJs(~component, jsProps =>
make(~match_=jsProps##match, ~history=jsProps##history, [||])
);
import React from "react";
import { withRouter } from "react-router-dom";
import Navigator from "./Navigator.bs";
const Parent = ({ match, history }) => <Navigator match_={match} history={history} />;
export default Parent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment