I'm trying to improve error handling for my app, so I've create a very simple component ErrorComponet.jsx:

import React from "react";

const ErrorComponent = (props) => {
  return (<pre>{JSON.stringify(props, null, 1)}</pre>);

export default ErrorComponent;

Then inside layout i use that on the placeholder:

<Placeholder name="jss-hero" rendering={route} errorComponent={ErrorComponent} />

But when I run the application I get a warning

index.js:1 Warning: Failed prop type: Invalid prop `errorComponent` supplied to `PlaceholderComponent`.
    in PlaceholderComponent (created by Context.Consumer)
    in WithComponentFactory (at Layout.js:26)
    in main (at Layout.js:25)
    in Layout (at RouteHandler.js:183)
    in RouteHandler (at AppRoot.js:27)
    in Route (at AppRoot.js:35)
    in Switch (at AppRoot.js:33)
    in Router (created by BrowserRouter)
    in BrowserRouter (at AppRoot.js:32)
    in SitecoreContext (at AppRoot.js:31)
    in ApolloProvider (at AppRoot.js:30)
    in ErrorBoundary (at AppRoot.js:29)
    in AppRoot (at src/index.js:70)

What can I do to get rid of this warning?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.