Issue I am using Nextjs Static HTML Export and it’s generating each page (Just HTML Code) with a size of 100kb + on disk. Is there a way to reduce page size on disk? Solution I reduced page size by
Continue readingTag: next.js
[SOLVED] Saving data to Mongodb mapping out array automatically
Issue I have been storing data into my mongodb collections for a while now with something like the below: const addDoc = { email: req.body.email, name: req.body.name, region: req.body.region, field1: req.body.accountData.field1, field2: req.body.accountData.field2, field3: req.body.accountData.field3, field4: req.body.accountData.field4, field5: req.body.accountData.field5, }
Continue reading[SOLVED] Update state in useState with object as input in function component
Issue Function component is used here export default function Account() { defining const with inputs as objects const [state, setState] = useState({ profile: true, orders: false, returns: false, coupon: false, referrals: false, rewards: false, redeem: false, address: false, }); function
Continue reading[SOLVED] How to dynamically import non-React client side libraries in Next.js?
Issue I have a simple project import Music from ‘../components/music’; export default function Home() { return ( <Music></Music> ) } import dynamic from ‘next/dynamic’; const abcjs = dynamic(import(‘abcjs’), { ssr: false }); export default function Music({note}) { return ( <>
Continue reading[SOLVED] How to access query params inside getServerSideProps in Next.js?
Issue I am trying to use get getServerSideProps in my code and I am not able to do it because I am not able to pass router.query.itmid. export async function getServerSideProps() { // Call an external API endpoint to get
Continue reading[SOLVED] Nextjs: onChange input not change value on self
Issue This is my code: const [defaultBuy, setDefaultBuy] = useState({ data: ”, price: 0 }) const changeBuyPrice = (e: any) => { let value = e.target.value if (value > 1000) { value = 9000 } console.log(value) setDefaultBuy({…defaultBuy, price: value}) }
Continue reading[SOLVED] Custom font is not working in TailwindCSS & ReactJS project
Issue I am using custom font in my React/TypeScript/TailWind/NextJS projects. I stored font in my /fonts folder as Glimer-Regular.ttf. Then in my global.css I declared as below. @layer base { @font-face { font-family: ‘"Glimer"’; src: url(../../fonts/Glimer-Regular.ttf) format(‘ttf’); } } In
Continue reading[SOLVED] Wallet get's disconnected from next.js solana application
Issue I have followed a YouTube tutorial to create a solana application, all my code works fine and the wallet gets connected successfull, but when I refresh the page the wallet gets disconnected and the function getWallet returns nothing (connected
Continue reading[SOLVED] Importing React State into CSS file
Issue I am currently working on a NextJS based project, in which I need to use React State to determine the width of a div. Currently this is being calculated inside a .tsx file using consts and incremented when a
Continue reading[SOLVED] Next.js: How to prevent flash of the Unauthorized route/page prior to redirect when implementing a private route?
Issue Essentially I created a HOC for two pages in my Next.js app (i.e. profile and dashboard) two prevent users from accessing them if they’re not authorized. Example: pages/profile.js import withAuth from "../components/AuthCheck/index"; function Profile() { return ( <> <h1>Profile</h1>
Continue reading