S
SolidJS•15mo ago
Mathieu

Can I avoid the getter while keeping the reactivity?

const [organization] = useSelectedOrganization();

const formatMoney = () => moneyFormatter(organization);
const [organization] = useSelectedOrganization();

const formatMoney = () => moneyFormatter(organization);
organization is reactive. I have a function returning me a money formatter (according to the organization's settings). The issue is in the code I have to use formatMoney like such:
formatMoney()(amount, currency)
formatMoney()(amount, currency)
Is it anyhow possible to keep reactivity on organization but to write:
formatMoney(amount, currency)
formatMoney(amount, currency)
2 Replies
thetarnav
thetarnav•15mo ago
const [organization] = useSelectedOrganization();

const formatMoney = (amount, currency) => moneyFormatter(organization)(amount, currency);
const [organization] = useSelectedOrganization();

const formatMoney = (amount, currency) => moneyFormatter(organization)(amount, currency);
Mathieu
MathieuOP•15mo ago
Oh man 😂 Thank you!!
Want results from more Discord servers?
Add your server