TypeError: __jsx is not a function #17329
-
Bug reportDescribe the bugusing custom _app.js const MyApp = ({ Component, pageProps, store }) => <Component {...pageProps} /> To Reproduce
Expected behaviorCompile successful ScreenshotsSystem information
Additional contextAdd any other context about the problem here. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi! There are several errors on your
I don't get what you're trying to achieve here: static async getInitialProps({Component, ctx}) {
const pageProps = Component.getInitialProps ? await Component.getInitialProps(ctx) : {};
return {pageProps: pageProps};
} The only argument static async getInitialProps({Component, ctx}) { Besides that, it seems you're trying to replace It seems you're trying to have blocking data requirements for every single page in your application, which should probably be avoided:
But if that's really what you're trying to do, replace your static async getInitialProps(ctx) {
const appProps = await App.getInitialProps(ctx);
return { ...appProps };
} Your usage of next-redux-wrapper is also wrong. Note the correct imports and wrapper stated on docs: import { createWrapper }from "next-redux-wrapper";
const store = createStore(cartReducer);
const makestore = () => store;
const wrapper = createWrapper(makestore, {debug: true})
export default wrapper.withRedux(MyApp) Note that at the end of the usage
So you'll probably need to rewrite this as a Functional Component to use that lib. |
Beta Was this translation helpful? Give feedback.
Hi!
There are several errors on your
_app.js
preventing your page to render.import React from 'react-dom'
React
doesn't need to be imported if you're only willing to use JSX, if you're willing to use something available underReact
, you need to import it by doingimport React from 'react'
.getInitialProps
I don't get what you're trying to achieve here:
The only argument
getInitialProps
receives is thectx
itself. So this line is currently receivingundefined
for these destructured values: