Replies: 1 comment
-
This is an interesting idea. On the one hand, we could shave some bytes, but on the other hand, we risk breaking the readability and the internal logic visualizer. With Zag.js, we want to keep things maintainable and readable. I intend to add more strict typings to reduce the chance of typos |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I've noticed that things like
actions
,tags
,activities
,guards
andtargets
are usually just regular strings. Is there any reason to not store them as objects/variables? I think this would offer a better dx, both by reducing typos and by increasing visibility.I also think it could lead to a slight reduction in bundle size, as most bundlers do not fold string literals into a variable. I think it would be very minor, but it could shave off a couple of kb. I think there's a tipping point w.r.t string ocurrence frequency, but I'd assume this is an all-or-nothing scenario.
I'm not sure of the performance difference between creating new string literals and accessing an object, so that's something one would have to consider.
https://gist.github.com/Jonas-C/113fb7d14df14394c4cac3c3155469d7
Beta Was this translation helpful? Give feedback.
All reactions