Best practices variables

Hi there,

During development I noticed that the number of variables can grow quite fast. I am taking more and more the approach to reuse variables as much as possible. This because as I understand a variable lives in the context of session. So I use for example:

modalOpened: boolean - to use for each modal (that is used on a different page). When using tabs and having multiple modals ons a page I am thinking to add current tab to the visibility conditions of the modal.

SelectedObject: {} (empty object). I use this to bind the data of a whole object. To use on modal forms.

How do you all efficiently and securely use variables in Weweb and are the common best practices te follow?

1 Like

Great question!
We mentioned possible solutions here in the Office Hours.

Hope that helps take care!

Hello Doc, are you sure that this is the good link haha ? I’m getting this on click


Thanks

1 Like

yeah looking for this same info and the current link is not working

1 Like

Whoops sorry about that! :smile: Let’s try this again here is the correct link.

Thank you for your patience!

1 Like

Awesome so use objects whenever you can. Darn wish i new that sooner haha. it makes alot of sense.

“site settings can be an object. user variables can be a user object etc. group similar variables into an object. so at the minimum they’re easier to manage”