-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Use case scenario:
Server renders:
<script>
window.__PRELOADED_STATE__ = ${transit.toJSON(preloadedState)};
</script>
Client picks up __PRELOADED_STATE__
, which is a valid JSON, therefore it is converted to an object. To use it, I need to cast it back to string, e.g.
console.log('window.__PRELOADED_STATE__', transit.fromJSON(JSON.stringify(window.__PRELOADED_STATE__)));
Alternatively, I can stringify the object twice on server: once using transit-immutable-js
and
second time using JSON.stringify
, e.g.
<script>
window.__PRELOADED_STATE__ = ${JSON.stringify(transit.toJSON(preloadedState))};
</script>
Preferably though,transit-immutable-js
should be able to accept an object.
Metadata
Metadata
Assignees
Labels
No labels