Creating front-end reuseable expressions between pages

Returning data from custom events means it is now much more possible to have reusable dynamic expressions for complex calculations.

For example, you may have a tax calculator which estimates tax savings based on a set of inputs. You may want to run this calculation on both the dashboard page, for logged in users, and a marketing page, as a lead magnet.

In order to use the same calculation for both, use a reuseable element, and place a custom event inside the reuseable element. The custom event takes the necessary parameters, and returns the result. You just need to have the reuseable element somewhere on the page (1x1px will hide it).

This is useful for complex calculations that you don’t want to repeat, and maintainability, as it means that you only have to change an expression in one place in your app. If you want to be super-maintainable, you can use the front-end custom event to call a backend custom event via an API call so that you can access the same custom event from the front-end and backend, though that will have speed and WU implications.


using custom events for complex calculation makes bubble app more usable and easier to maintain.