Pinterest Clone saved image?

Pinterest Clone saved image?


I am working on fullstack Pinterest Clone project with Reactjs and I wonder how can I implement the pinned function? How do I code the part where the user clicks on the pin/save image and the image is added to the user’s wall? Any advice appreciated! Thanks


So, when I started the Fullstack projects (especially the later ones), I had to really sit and think about how I wanted to store my data. Because ultimately, the interface of your project depends on the data coming from your server, right?
For the Pinterest Clone, I kept my data pretty simple. I stuck all the information I needed in a single User object. So the pins a user saved were just stored as an array against the user. Here is my User.js server-side file as an example:

const mongoose = require('mongoose');

const UserSchema = new mongoose.Schema({
  name: String,
  id: String,
  picture: String,
  pins: []

module.exports = mongoose.model('User', UserSchema);

Once you have decided how to store your data, then it becomes looking up your user and adding pins to their pins array. I hope this helps!