Skip to content

Implementation ErrorBoundary component with jsx ppx #54

Closed
@mununki

Description

@mununki

ErrorBoundary is implemented by using jsx ppx now, but it has a warning in runtime.

Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
    at RescriptReactErrorBoundary

It is caused by the generated js representation is not fit to React API.

// with jsx ppx @react.component
function RescriptReactErrorBoundary(Props) {
  return getErrorBoundary(React.Component);
}

var make = RescriptReactErrorBoundary;

But, it should be

// without @react.component
var make = getErrorBoundary(React.Component);

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