Skip to content
Fix Code Error

Tag: next.js

Using revalidate in NEXT.JS

July 18, 2021 by Code Error

Posted By: Anonymous At the moment, I am trying to make an application with NEXT.JS. When I come to revalidate of page using method ISR. I very confused to understand how it works for the system or how is it auto to rebuild data of the pages in the system? Many thanks. Solution You can …

Continue Reading

Question about performance in development mode – next.js

July 18, 2021 by Code Error

Posted By: Anonymous I’m building my first project with next.js, and it’s been a crazy journey so far, and it’s been great, but, i’ve noticed something about this thechnology that kinda bothers me. Not onyl in the development of my app, but in the course i did, i’ve noticed that next.js is a litle bit …

Continue Reading

Nextjs seperate process for frontend and backend

July 17, 2021 by Code Error

Posted By: Anonymous I am using custom server in nextjs. Everytime I make a change in the frontend or backend, nodemon restarts the main process and the child processes. This results in an increased build time. My expectation is that when I make a change in the pages or other frontend component, the already running …

Continue Reading

How to return { redirect: { destination: “/some-path”}} from getStaticProps (from Next.JS) without error from Typescript?

July 17, 2021 by Code Error

Posted By: Anonymous Problem I’m using Next.JS with Typescript. I get an error when I try to return a redirect if the data doesn’t exist. Code import { GetStaticProps } from "next"; import fs from "fs/promises"; import path from "path"; function HomePage({ products }: { products: { id: string; title: string }[] }) { return …

Continue Reading

How to setup getStaticPaths of multi-locale dynamic pages in Next.js

July 17, 2021 by Code Error

Posted By: Anonymous Today, in my side-project, I got a problem relate to setup getStaticPaths of multi-locale dynamic pages in Next.js. I researched and find out that there are so many people stuck in this problems. I have created a dynamic page [slug].js to handle all dynamic datas I got from a database. And my …

Continue Reading

Use i18next translation hook for error messages

July 17, 2021 by Code Error

Posted By: Anonymous So I have a form which works fine and for error messages I have created a schema file which contains errors defined like this export const dataInputCreateSchema = yupObject({ company: yup.object().required(‘This field is required’).nullable }) In my component I am initializing my i18next translation variable like this const { t } = …

Continue Reading

How to send data to another NextJS page?

July 15, 2021 by Code Error

Posted By: Anonymous I would like to base an input search. To be able to send the content to another page which then makes an API request with the content of the input search. Basically I would like the user to be able with the search bar, type "something" and that this "something" I get …

Continue Reading

getServerSideProps is not updating data with import

July 14, 2021 by Code Error

Posted By: Anonymous I’m having a problem with getServerSideProps in NextJS not updating values on page load. It seems to be having the same effect as using getStaticProps when calling from data that is an imported json file. Here’s the applicable code: /update/[…id].js import { hasPermission, getPermissions } from ‘../../lib/permissions’ … //in the page function …

Continue Reading

Encoding static imagery from public folder using getStaticProps in Next.js

July 14, 2021 by Code Error

Posted By: Anonymous Next.js lays out a pretty comprehensive way to get imagery from the /public/ folder (where the app has you store static assets). The pattern is to use fs from Node and do the fetch in getStaticProps. My attempt: export async function getStaticProps({ params, preview = false, previewData }) { const cityData = …

Continue Reading

Render different classes based on Path NEXTJS

July 13, 2021 by Code Error

Posted By: Anonymous I have a Header.JS file which has a navigation component, sometimes I need the left menu to render and sometimes I need the right one to render based on the page. If my path is / I want to render <Navigation menu={menus?.left_menu} styles={styles} className={styles.leftMenu} /> if my path is anything else like …

Continue Reading

define is not defined while build nextjs app

July 12, 2021 by Code Error

Posted By: Anonymous i’m using next version 10.0.1, and react 17.0.2, When i’m trying build my next app, i get an error: ReferenceError: define is not defined at Object.<anonymous> (/Users/***/Desktop/gm/toesim-web/node_modules/@glonassmobile/codebase-web/createAction.js:1:1) at Module._compile (node:internal/modules/cjs/loader:1092:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10) at Module.load (node:internal/modules/cjs/loader:972:32) at Function.Module._load (node:internal/modules/cjs/loader:813:14) at Module.require (node:internal/modules/cjs/loader:996:19) at require (node:internal/modules/cjs/helpers:92:18) at Object.i1ag (/Users//Desktop/gm/toesim-web/.next/server/pages/deeplink/payment/[paymentId].js:7425:18) at __webpack_require__ (/Users/Desktop/gm/toesim-web/.next/server/pages/deeplink/payment/[paymentId].js:23:31) at …

Continue Reading

Is this transpilation issue correctly filed against babel-jest?

July 12, 2021 by Code Error

Posted By: Anonymous I raised an issue https://github.com/facebook/jest/issues/11504 against the jest project, which I think is responsible for maintaining babel-jest. Transpilation totally fails after adding apparently harmless and error-free code. However, there are a lot of layers to the transpilation of a Typescript Next project, so I am unsure if this is the correct place …

Continue Reading

method onChange not working in radio button

July 12, 2021 by Code Error

Posted By: Anonymous I have a form with a radio button that have to do something when the item selected changes, but it only happends when the page loads but no when I select other item This is my code: <div key={item} className="lg:w-1/2"> <label className="flex items-center mx-6" htmlFor={item.option_image.alt} > <input className="w-5 h-5 mr-4" type="radio" id={item.option_image.alt} …

Continue Reading

Using .env.local file. Getting process.env.NEXT_PUBLIC_VERCEL_ENV is undefined on client

July 11, 2021 by Code Error

Posted By: Anonymous I’m using Next.js with Vercel. This is my .env.local file: # Created by Vercel CLI VERCEL="1" VERCEL_ENV="development" VERCEL_URL="" VERCEL_GIT_PROVIDER="" VERCEL_GIT_REPO_SLUG="" VERCEL_GIT_REPO_OWNER="" VERCEL_GIT_REPO_ID="" VERCEL_GIT_COMMIT_REF="" VERCEL_GIT_COMMIT_SHA="" VERCEL_GIT_COMMIT_MESSAGE="" VERCEL_GIT_COMMIT_AUTHOR_LOGIN="" VERCEL_GIT_COMMIT_AUTHOR_NAME="" I have a component that is trying to access: process.env.NEXT_PUBLIC_VERCEL_ENV to make sure it is on development environment. This is what I’m getting when running …

Continue Reading

React/Next.js doesn’t seem to work with Apexcharts

July 11, 2021 by Code Error

Posted By: Anonymous Problem My Next.js/React/Node app crashes when I import Chart from "react-apexcharts" in any file. Attempting to visit the app results in the following error: Server ErrorReferenceError: window is not definedThis error happened while generating the page. Any console logs will be displayed in the terminal window. (see call stack below). This happens …

Continue Reading

using ref in typescript nextjs

July 11, 2021 by Code Error

Posted By: Anonymous I learning typescript in react but got an warning import {useref} from ‘react’ export default function test(){ cons tmp = useRef() const data = tmp.current?.value return ( <div> <input type ="text" ref={tmp}/> </div> ) } but I got warning like this Property ‘value’ does not exist on type ‘never’.ts(2339) can someone help …

Continue Reading

onClick event problem- next.js and typescript

July 11, 2021 by Code Error

Posted By: Anonymous In the process of developing an app, in the fronted, i’m facing a weird problem with the onClick function, which is the following Type ‘(e: SyntheticEvent<Element, Event>) => void’ is not assignable to type ‘CustomValueType | MotionValue<number> | MotionValue<string> | MotionValue<any> | ((event: MouseEvent<{}, MouseEvent>) => void)’. Type ‘(e: SyntheticEvent<Element, Event>) => …

Continue Reading

how to generate dynamic pages without knowing the static paths on NextJS?

July 10, 2021 by Code Error

Posted By: Anonymous I want to route my users to a page where they can get discounts based on their citizenship id numbers. I will use their id number to determine the amount of discount they get. I can use their id to determine Location, Age, Gender etc. They can route to mywebsite.com/megadiscount and fill …

Continue Reading

Next.js – Expected server HTML to contain a matching in

July 9, 2021 by Code Error

Posted By: Anonymous Live example available here I’m trying to make a basic layout where, on mobiles, only the latest posts appear. On desktop, the left column should be the posts and the right column the top categories and most popular posts. Here is the layout: const IndexLayout: React.FC<IndexLayoutProps> = ({}) => { const cols …

Continue Reading

Nextjs – Access global context values

July 9, 2021 by Code Error

Posted By: Anonymous I would like to see how I can create global contexts in NextJS and have global variables inside the app. Currently I have AppContext.js as import { createContext } from ‘react’ const AppContext = createContext(); export default AppContext _app.js const [socketio, setSocketio] = useState(null); const appContext = { socketio }; return( <AppContext.Provider …

Continue Reading

Deployment on Vercel with Auth0: Can’t resolve ‘@auth0/nextjs-auth0’ in ‘/vercel/path0/pages’

July 8, 2021 by Code Error

Posted By: Anonymous I have a project that already was deployed on Vercel. Since last week Im working on improve the layout with the goal of finish a MVP of this project. So, I changed my usage of auth0, using the package to nextjs @auth0/nextjs-auth0. I ran npm install @auth0/nextjs-auth0 and I have on my …

Continue Reading

Trying to export backup via admin.firestore.v1.FirestoreAdminClient on a Next.js API route. Error: Could not load the default credentials

July 8, 2021 by Code Error

Posted By: Anonymous I’m trying to run this code to implement a Firestore backup. But for the first time, I’m deploying it into a Next.js project. I’ll hit it on my /api/backup endpoint. const backupHandler: NextApiHandler = async (req,res) => { try { const admin = initializeFirebaseAdmin(); const PROJECT_ID = getProjectId(); const client = new …

Continue Reading

React-Query and NextJS Fetching Data Converting circular structure to JSON Error

July 7, 2021 by Code Error

Posted By: Anonymous I’ve built this simple project with react-query and nextjs , after running the project it gives me this error in the console, what did i do wrong ?! TypeError: Converting circular structure to JSON –> starting at object with constructor ‘QueryClient’ | property ‘queryCache’ -> object with constructor ‘QueryCache’ | property ‘queries’ …

Continue Reading

Should you use next/link (prefetched client side transitions) for pages with any dynamic content?

July 7, 2021 by Code Error

Posted By: Anonymous From: next/link You can see that the <Link> component from next/link enables client-side transitions and link prefetching, which are great features, but maybe not for all cases. Please see the caveat I’ve run into. Let’s say I have the following pages: Home – Some landing page with a nav bar Latest – …

Continue Reading

Snipcart – possible to make a custom cart using React?

July 7, 2021 by Code Error

Posted By: Anonymous I am making a Next website, and added Snipcart. The Snipcart UI embeds Vue, and has embedded images in it, and an external CSS file, which all in all add a ridiculous amount of time to my page load time. I also don’t quite like the UI, but that’s a more minor …

Continue Reading

Check Image URL before updating State in React / Next

July 6, 2021 by Code Error

Posted By: Anonymous The logic below is in: React / Nextjs with styled-components. Hello, I have a component that "renders" a blog banner (background-image), the url comes from a state that already has a standard image. const [blogBanner, setBlogBanner] = useState (‘/ images / imageBlogDefault.png’) But before the component receives this state, the code checks …

Continue Reading

API resolved without sending a response for /api/repositories, this may result in stalled requests

July 6, 2021 by Code Error

Posted By: Anonymous I use NextJS API interfaces as Server Sent Events as follows: const handler = async (req: NextApiRequest, res: NextApiResponse) => { … … res.setHeader("Content-Type", "text/event-stream;charset=utf-8"); res.setHeader("Cache-Control", "no-cache, no-transform"); res.setHeader("Connection", "keep-alive"); const observer: Observer<RepoInformation> = { next: value => { res.write(`event: receivedn`); res.write(`data: ${JSON.stringify(value)}nn`); }, error: (err: Error) => { res.write(`event: data-errorn`); res.write(`data: …

Continue Reading

How to delete fields and their data from controlled form?

July 5, 2021 by Code Error

Posted By: Anonymous I have an array fields which represents form fields. These fields are controlled, their values are stored in form. const [fields, setFields] = useState([]) const [form, setForm] = useState({}) … fields.map(function(element, index) { return <input name={‘field ‘+element} key={index} /> }) I can add fields dynamically: setFields([…fields, someNextField]) I can also delete fields: …

Continue Reading

Animating an SVG pattern background

July 5, 2021 by Code Error

Posted By: Anonymous I’m currently designing a new website with NextJS and Tailwind and I would like to make a background that is infinitely translating to the bottom right, just like in this example (but with my own pattern): https://codepen.io/kootoopas/pen/reyqg I’ve actually never worked with SVG patterns before. Though I’ve managed to display an SVG …

Continue Reading

invalid hook call with nextjs inside custom hook

July 5, 2021 by Code Error

Posted By: Anonymous I’m getting a invalid hook call error when using state inside my custom hook. Here’s my code import { useState } from ‘react’; export default function useFetch() { const [randomValue, setRandomValue] = useState<number>(); setRandomValue(3); return randomValue; } the hook is inside my hooks folder on the path: ./src/hooks any reason for that? …

Continue Reading

Posts navigation

  • 1
  • 2
  • 3
  • 4
  • …
  • 69
  • Next

.net ajax android angular arrays aurelia backbone.js bash c++ css dataframe ember-data ember.js excel git html ios java javascript jquery json laravel linux list mysql next.js node.js pandas php polymer polymer-1.0 python python-3.x r reactjs regex sql sql-server string svelte typescript vue-component vue.js vuejs2 vuetify.js

  • you shouldn’t need to use z-index
  • No column in target database, but getting “The schema update is terminating because data loss might occur”
  • Angular – expected call-signature: ‘changePassword’ to have a typedeftslint(typedef)
  • trying to implement NativeAdFactory imports deprecated method by default in flutter java project
  • What should I use to get an attribute out of my foreign table in Laravel?
© 2022 Fix Code Error