score:2
Good times when this was my biggest problem lol
For whoever really needs an answer to this:
You can't currently use getStaticProps and getServerSideProps in the _app component, so if I'm not wrong I was trying to fetch initial data (probably categories list) and pass it to a component. To fetch initial data at _app level, you should use getInitialProps (NextJs developers suggest to avoid using this), but be aware that using it, will stop NextJs from automatically statically optimize the pages that do not rely on any kind of fetching method (they will be server-side rendered - even a simple "about us" page that could be served as static html otherwise)
You can read more about it here: https://nextjs.org/docs/api-reference/data-fetching/getInitialProps
Source: stackoverflow.com
Related Query
- Nextjs - passing props from custom _app.js to <Navbar> component?
- React.Js Passing props from component to NavBar component?
- NextJS - Passing state to children as props in custom app
- Passing custom props to router component in react-router v4
- React.js : Passing Props from a Function to a Component
- Props are not passing from parent to child components in React Functional component
- Passing props from one class component to other in react js
- Passing API response data from Redux state to component props
- Passing props to child component from two different Parents
- React passing props from const to child component
- Passing props from component to componet using react hooks
- Passing Props from Route to Component in React
- Passing props to dynamic component in NextJS
- In NextJS Is it possible to have custom _app.js read a slug, getInitialProps and pass those props to every component including all pages?
- Passing props to UseEffect hook from Parent component
- Error Coming when passing props from one component to another and vice - versa in react using typescript
- Passing props from higher level component to lower level component, React Router in play
- Passing Props to Child component from Parent using cloneElement
- Passing props to Children component from Parent state- React Router
- Passing props from a navlink to a component React Router
- Reactjs How i can pass props from index.html to App component with Typescript
- React JS - passing info from object and array as props to child component
- passing props through Route in react. sending a property from a child of component tree to other component
- Passing the props from one component to another in react
- Passing custom props to each styled component through Provider
- Reactjs: Passing props from card component to tab component
- Passing props from class to nested functional component
- Props object what is the meaning of passing children to the component from React official documentation
- passing props from parent to child in react class based component
- How can i initialize state by passing props from parent component to child component in ReactJS?
More Query from same tag
- Axios cancel token cancelling every request
- Is using both Inheritance and Composition a good practice in React Class Components?
- Auto trigger click event handler on last element of array map. Reactjs
- react routing with parcel and router dom 6.3
- view page source does not show page in nextjs
- react return markup from dangerouslySetInnerHTML
- Updating the `URL` but not loading the path
- Chakra UI using multiple models in a single component
- DOM remove method in react js
- Correct way of calling a component/function in React?
- React component error message using filter method
- How to display live camera feed in reactJs
- React bootstrap navbar1
- Reactjs Axios Post Requests don't run
- Value doesn't change using setState() ,React nested API call
- React Event Handling For Each Icon
- How to display data from json in React
- How can I better animate a modal using CSS?
- style Property on JSX Element Not Updating Properly
- React array state keeps resetting on update in functional component
- Mapping inside a map function, while getting the data from the state a of parent component
- Setting the default value inside the input field in the antd library after calling the function in useEffect
- FieldValue is undefined
- Redux : reset 1 variable to initial state in Redux
- How to make card component align in one row (React)
- How to "think in React" for this complex example?
- Is there a way to make sure child components fire actions after parent components?
- How to fix 'element implicitly has an 'any' type. TS7031' for function?
- Position component relative to its child
- React test for prop method