I’m building a taskmanagment application, where only admin can delete user. when admin delete a user, I want to assign deleted users task to the his assignby user. when I delete devid user from the db I want to assign his task to the john and save the task Answer I think you are looking for transactions to avoid loss
Tag: mern
Mongoose how to extract value from findOne() and use that to update value
And the console log shows flightNo as { flightNo: ‘UA567’ } I want to use the flightNo “UA567” in findOneAndUpdate. But this function fails. How can I extract the string from the object? Answer flightNo is an object which contains the field ‘flightNo’, you can access the value of that field by writing or you can write and destructure that
Uncaught Error: [Topbar] is not a component. All component children of must be a or
I have looked at the previous questions and googled for the answer and I think I almost know what the issue in here is, but don’t know how to solve it. Please tell me how to setup the topar and slidebar components here. Requesting my fellow coders to look at this one and thanks in advance. Answer The error is
could not render component in react
When I use history.push () method, from signup to log in, goes to a particular API/URLenter code here but does not render the login component. Answer Do not create new history. You can use useHistory that exported from react-router-dom instead and get the current history. It would be something like this:
Error: animal.image.map is not a function
I am currently making a shelter web app using mern stack and i am struggling to display an image from my object. i already used the map but i think it is only for array objects. so i am clueless how to get the images.url on my animal object. this is my animalSchema AnimalReducer and this is what i use
how can i get the value of a variable outside the arrow function in mern stack
i want to get the value of this variable outside the function const custDetail = await registeredUser.findOne(req.params); Answer Edit a simple way to pass data to another function using res.locals router: dashboardReq nextFunction
How to make this code compatible for react-router v6
In ProtectedRoute.js I have coded: and in App.js I have written as: Error says: [ProtectedRoute] is not a Route component. All component children of Routes must be a Route or <React.Fragment>. Is there something missing! Thank you Answer In react-router-dom custom route components are no longer used. Routes components can have only Route and React.Fragment components as children, and Route
Functions are not valid as a React child. This may happen if you return a Component instead of from render. in react v6
Hello I’m new to react and got myself stuck here, my version is v6 and hence having a bit of a problem understanding, I’m following a tutorial from udemy The error that occurred is – Functions are not valid as a React child. This may happen if you return a Component instead of from render. Or maybe you meant to
Component is not rendering even after routing | React JS | React Router v6
For now i have two components. What i want to do is that after a successful login i will redirect the user to a homepage. But when i am trying to do that its not happening . Although the routes are changing in the url but the previous component is not going and overlapping with the new component. I have
Axios Undefined Response
I am Developing MERN Stack Project. The problem is when I make the first API Call the first response is undefined and the map function gives an error ‘Map is not a function and it makes sense. the problem is i tried several approaches to prevent this from happening but it won’t work This is the Code of the Component