Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RedBox require and add a test #314

Merged
merged 1 commit into from
Sep 3, 2016

Conversation

nathanmarks
Copy link

This addresses #312 .

Right now in the console we're seeing an error crop up because AppContainer.dev is attempting to render the Redbox module export but the component sits on .default due to babelification and AppContainer is using require().

@EloB
Copy link

EloB commented Jul 19, 2016

Please merge this because it's very hard to develop right now with the beta. The error output without this is also pointing you at the wrong code! So I have to remove the <AppContainer> from the render function when ever I get an error that I don't know where it's located.

@peterbe
Copy link

peterbe commented Aug 1, 2016

My index.js now looks like this:

const rootEl = document.getElementById('root');
// If you get errors like:
// Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of `AppContainer`.
// then comment out these lines and uncomment the ones below.
ReactDOM.render(
  <AppContainer>
    <App />
  </AppContainer>,
  rootEl
);
// ReactDOM.render(
//   <App />,
//   rootEl
// );

:(

@blesswinsamuel
Copy link

My temporary fix:

const mount = document.getElementById('app');

render(
  <AppContainer errorReporter={({ error }) => {throw error}}>
    <App store={store} />
  </AppContainer>,
  mount
);

@quaninte
Copy link

Please merge this one 👍

@jiripudil
Copy link

jiripudil commented Aug 30, 2016

Until this is merged, you can still use redbox-react for error reporting, just import it yourself correctly and overwrite the default errorReporter prop:

import RedBox from 'redbox-react';
// or
const RedBox = require('redbox-react').default;

render(
    <AppContainer errorReporter={RedBox}>
        <App />
    </AppContainer>,
    mount
);

Also, bump :)

@calesce calesce merged commit 6e7eee7 into gaearon:next Sep 3, 2016
@nathanmarks nathanmarks deleted the fix-redbox-require branch September 3, 2016 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants