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?

  • did you solve this in the end? – James Darrall Jan 19 at 10:09
  • nope, i've not gotten any solution to this yet – devzero Jan 20 at 10:06
  • I've raised it with Sitecore support and also recreated it in the JSS test app - will update with anything they come back with! – James Darrall Jan 20 at 14:42

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.