docs/explanation/serializable-state.md
Marko seamlessly picks up where the server left off when it comes to events, scripts and client side updates through state. In order to do this Marko will attempt to serialize as little data as possible from the server to the client.
Most standard data types can be serialized, including:
null, boolean, number, string, bigint... and many more.
Some values cannot be serialized. When these values are encountered the Marko runtime will provide a helpful message to locate the relevant code.
Examples of unserializable data include:
[!NOTE] Most functions and closures are serializable.
marko<let/handler=null> <const/onSecondClick() { // serializable! }> <button onClick() { handler?.(); handler = onSecondClick }/>
// ❌ BAD: custom class instance in state
<let/state=new Cart()>
// ❌ BAD: DOM nodes in state
<let/state={ el: document.body }>