I want to convert the following array (userNameApp) into string so I can insert the following array into the database as a string
var userInfo = JSON.parse(window.localStorage.getItem('current-session'));
const userNameApp = useState(userInfo['fname'] + " " + userInfo['lname']);
console.log(userNameApp);
In the console log, the result is First Name + Last Name. When inserting in the database, I will post it like this
Axios.post("http://localhost:3001/insertActiveUser", {userNameApp: userNameApp}))
Inside the database schema/model, the type of Value is string.
const mongoose = require("mongoose");
const User Details = new mongoose.Schema(
{
Username: String,
},
{
collection: "AppointmentDetails",
}
);
useStateYour wish of convertinguserNameAppinto a string doesn't make any sense, because the second element ofuserNameAppis afunction