reagent

2025-03-18T22:39:31.338779Z

following up on my question the other day about components in select options, it's annoying to have to track whether a given call to my translation function is in a reactive context or not: (tr ...) vs [tr ...]. is it possible to write a custom class that acts like a [tr ...] component for rendering purposes but has a toString that just calls the translation function?

p-himik 2025-03-19T09:06:07.137659Z

You can already use (tr ...) everywhere - it's just that any changes to the relevant data used in tr will re-render not a specific instance of [tr ...] but the whole parent component.

2025-03-19T13:31:57.731409Z

huh okay

2025-03-19T13:32:08.188759Z

for some reason i though that wasn't working but it seems i messed something up

2025-03-18T22:40:30.674409Z

that way, i could call (tr ...) everywhere, and it would return an object that works in both contexts