score:56
you should move your components
outside the pages
folder. pages/
should only be used for page components as next.js routing is based on its structure.
next.js has a file-system based router built on the concept of pages.
when a file is added to the pages directory it's automatically available as a route.
even though the above is the default behaviour, you can configure your next.js app to include non-page files in the pages
directory.
to do so, you can modify the pageextensions
entry in the next.config.js
file as shown below. then rename your page components to have a file extension that includes .page
(_document.page.js
, _app.page.js
, index.page.js
, etc).
module.exports = {
pageextensions: ['page.tsx', 'page.ts', 'page.jsx', 'page.js']
}
with this configuration, next.js will ignore any file that doesn't contain .page
for the purpose of building pages/api routes and routing.
score:0
it seems to be not declared default export keyword in context component. try it as follow:
const context = ()=>{
...
}
export default context
Source: stackoverflow.com
Related Query
- Can't build React/Next project - found page without a React Component as default export (context api file)
- Got the error "Build optimization failed: found page without a React Component as default export in pages/"
- Got the error "Build optimization failed: found page without a React Component as default export in pages/" Help me
- React Router - Go back to the last page visited, and not the default component
- how to update a route in React Router without re-mounting the component in a single page app?
- why React production build only shows the 404 page without the rest of the page?
- Attempt to build a generic form component in React without using eval()
- 404 Not Found when hard reload the page in react js with react build
- Not found page and default home page always redirect to home - React Router
- Default today's date in date picker using react js without using DatePicker component
- Function component on the same page in not picking in route (react-router-dom v6) of react project
- How create React Typescript component with required and optional values but required value without default value?
- Can I remove query params of the current page without removing component state React Router?
- React : "Module not found " when importing component from a local project
- reload react component without reloading the page
- is there any way to run React + Django in same project without running npm run build again and again?
- Can you force a React component to rerender without calling setState?
- Default property value in React component using TypeScript
- How to set component default props on React component
- React functional component default props vs default parameters
- react router v4 default page(not found page)
- React Router BrowserRouter leads to "404 Not Found - nginx " error when going to subpage directly without through a home-page click
- Ignore or prevent ESLint errors from breaking the build in a React project (create-react-project)
- How to build a production version of React without minification?
- How to upgrade a React project built with create-react-app to the next create-react-app version?
- React router - Update URL hash without re-rendering page
- React unable to import component -- module not found
- How to declare default props in react functional component
- Is it possible to run React project without npm start?
- React Native build failed: 'React/RCTBridge.h' file not found
More Query from same tag
- Attempted import error : 'createLocation' is not exported from 'history'
- How to change the word into icon in Show/Hide in ReactJs
- Reactjs custom hook won't fire using an if/else in useEffect?
- d3 zoom and slider issue working together
- React - Render happening before data is returned and not updating component
- React-select Async fetch
- React. Basic example of re-rendering using react-router. +100 rep
- In production Webpack 2.2.0.rc-0 will uglify/minify vendor.js and manifest.js but not bundle.js
- Is it possible: Webpack without npm?
- Insert map result inside table
- useContext across files causes circular dependencies
- Posting formatted string on postman
- Get value from e.target.name and use in react hooks setState
- How to fix the error type Item[] | undefined is not assignable to Item[] type using react and typescript?
- React-Redux: mapDispatchToProps methods not found
- How to stay Focus in react js?
- How to intersection query Real-time Firebase database?
- formatHTMLMesssage() function in React not rendering special characters
- Jest TypeError: e.preventDefault is not a function
- How to show html filter/map array with Onclick in React
- await is a reserved word error in ReactJS
- first material UI button hides
- the firebaseError error message display when trying to create new collection called message inside channelroom
- Image returned from REST API always displays broken
- IIS Redirect all request on root
- I am not able to get the updated internalStorage value instantly to update my cart notification in Reactjs
- Apollo Client calling every mutation and query twice (React)
- componentDidUpdate - Error: Maximum update depth exceeded
- How properly implement mutation on show page but not to the current resource on react-admin
- How can i generate a formatted random string using ReactJS