Api for nextjs is giving me a without an `onChange` handler for what reason, I don’t know.
Warning: You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.
at input
at div
at div
at div
at div
at div
at div
at div
at div
Above is the error I am getting, I have tried to fix my handler by looking in to the documentation, I have yet found any solution.
import { connectToDB } from "@utils/dbConnect";
import { verify } from "jsonwebtoken";
import { getGeneralStats } from "@utils/general";
import Users from '@schemas/users';
export default async function handler(req, res) {
try {
await connectToDB();
const { user } = req?.cookies;
const verifiedCookie = verify(user, process.env.JWT_SECRET);
const general = getGeneralStats();
const userInfo = await Users.findOne({userId: verifiedCookie.userId})
if(!userInfo)return res.status(400).json({success: false, user: {}, ann: general.ann})
const returnedUser = {
username: userInfo.username,
balance: userInfo.balance,
earned: userInfo.earned,
offers: userInfo.offers,
avatar: userInfo.avatar,
referred: userInfo.invited,
}
return res.json({success: true, user: returnedUser, ann: general.ann})
}catch(e){
return res.status(400).json({success: false , user: {}, ann: ""});
}
}
Seeking assistance to resolve an ongoing situation, your input is appreciated. Thank you/
I am expecting to fix this situation.