Closed anmonteiro closed 2 months ago
generated code looks like:
// Generated by Melange 'use strict'; const Js__Js_undefined = require("melange.js/js_undefined.bs.js"); const React = require("react"); function errorBoundary(_props) { let self = this ; React.Component.call(self); self.state = { error: undefined }; } errorBoundary.prototype = Object.create(React.Component.prototype); errorBoundary.prototype.componentDidCatch = (function (error, info) { let self = this ; self.setState({ error: { error: error, info: info } }); }); errorBoundary.prototype.render = (function () { let self = this ; if (Js__Js_undefined.testAny(self.state.error)) { return self.props.children; } else { return self.props.fallback(self.state.error); } }); const make = errorBoundary; exports.make = make; /* errorBoundary Not a pure module */
generated code looks like: