I tried to add two classname form styles but I could not add two CSS classes in a single div. Here is the screenshot: my code is as follows: blog.js Home.module.css Answer Instead of using single quote, you need to use backtick for template string: Check out this for more context
Tag: next.js
How to stop my component from being made twice in development
I am following this tutorial to make a javascript calendar in react I have a working calendar UI with the following code However in development, my calendar is made twice I assume this is because of React.StrictMode in development as useEffect seems to be running twice. If I run npm run build and npm start to mimic production, I only
how to use value of useState after init it
I these state hook: my medicalProblem variable will initial with response of a api : but I got this error: Answer There are a couple ways to accomplish this, but the easiest may be creating another useEffect hook that depends on the medicalProblems array as seen below! That extra hook will make sure your medicalProblems are populated before proceeding to
Change default color of button in Next.js
I am having a problem changing default color of buttons in Next.JS Web Application. It’s button text color is grey when I see it in google chrome in Desktop, but looks blue when I open it using my Mobile chrome browser. I want to make the button text color as grey in both of them. The way of customizing the
Reactjs/Nextjs onClick event not working for external component
I have a main page, with a button component i create to reuse in my project. My issue is when i add the onClick event to my external component, the click event is not working, but is i create the same button inside my main page, the click event works just fine Button Component This works on main page Button
Next.js project build error: Entry point for implicit type library ‘build’
I am trying to build nextjs project and getting this error: how can I build without this error? This is how package.json looks: I am trying to build using yarn build command Why am I getting this error and how can I get rid of it? Answer The issue is caused by this line in your package.json: Looks like yarn
Next.js and Express.js give CORS error, API queries only work at build time
I have a project where I use Next.js on the front-end and Express.js on the back. Front-end side The ‘pages’ file contains ‘index.js’. In it, I am sending the following request. Back-end side And here is my Route code : So, When the page is first built with Next.js, the api works, but when I click the ‘Load more’ button,
Smooth scrolling when clicking an anchor link on react/next.js
Is it possible using only CSS to make smooth scrolling when clicking an anchor link in react component? Answer There’s this: Source But I feel like JS does a better job: So you could give that a try: docs
Next.js site has favicon in chrome but not in brave
I’m developing my first next.js site and I’m setting the favicon in index.js as follows: Originally I was using a setup where my source files were all in the root directory. I now decided to move them to a src directory. Since then I have observed the following two weird behaviors: The site has a favicon in chrome but not
Next.js – best way to serve static JS from a node module’s “dist” folder
I’m working with an application that uses Tesseract (OCR) to read text from images. I would like to take some JS files from node_modules/tesseract.js/dist and make them downloadable in the browser. I know I can just copy the files to ./public and next.js will serve it statically from there, but then if I update my version of Tesseract, I may