How to share server data to a client side script? #1481
-
To put this out of the the way first, I know I can pass data to islands. This is not what I'm asking :) I have an old school JS script in the static folder (eg: How I've done this in the past is serializing the data into JSON and putting it into a
But I'm wondering if Fresh has something out of the box? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There is nothing wrong with writing data in a script tag. That's the way to do it. We could introduce some Fresh specific APIs, but then again I'm not sure if it would be "better" than passing a script tag or just the same thing a little different. The main thing the props serialization for islands add on top, is signals and bigint serialization. |
Beta Was this translation helpful? Give feedback.
There is nothing wrong with writing data in a script tag. That's the way to do it. We could introduce some Fresh specific APIs, but then again I'm not sure if it would be "better" than passing a script tag or just the same thing a little different. The main thing the props serialization for islands add on top, is signals and bigint serialization.