DEV Community

Mare
Mare

Posted on

Creating data specifically for each user in React / Node.js

I'm a beginner trying to create an Invoicing application. I went with React and Node/Express, and set up the authentication with Redux.

I'm currently trying to figure out how can i make it so that when a user logs in, he only sees the invoices he created himself. Because each time i connect with a different user i see the same data i previously created with another user.

What would be a solution in this case ? I thought about adding a foreign key of userId for each created invoice, is it a good idea ?

Top comments (1)

Collapse
 
solarrris profile image
SamuelBillot

I think your solution works fine.
Another solution can be to set up an array of invoices in your user object and just show this array to the user, i think it works too.