In a Reusable where I need the User and the User's SomeThing, pass both or just one?

So, what do you cowboys/girls prefer?

Imagine you have a reusable that needs the User data and also the User’s SomeThing. Imagine the SomeThing is a 1-to-1 relationship with the User. Do you create a prop for one or both?

In one hand, passing both makes it easier from within the reusable. On the other hand, I just increased the error surface by having to set 2 props on the reusable.

I’m guessing there are no performance gains one way or the other, correct?

Not sure how the ‘pros’ in Bubble do this…

for both of my SPAs, I just send the user. The user has like 3 1-to-1s. It’s easy for me to just do this user’s merchant business name, etc.

The other way just seems like confusing effort with results

With two props, there’s always a chance they’ll get out of sync and you’ll end up with mismatched data.

If you just pass one (like the User) and fetch the 1-to-1 related thing inside the reusable, you keep data integrity tight and avoid extra setup hassle.

Also, what feels obvious now, like how you access that SomeThing, might change over time. If you pass both, you’ll have to update every place the reusable is used. But if the logic lives inside the reusable, you only change it once, and with that single update, you can be confident that everything else will work correctly.

1 Like