# Astro Resume
Utilities for serializing data from server for use in the client.
1. `Serialize` - Astro component that takes `id` and `data`
1. `deserialize(id: string)` - a function for use in the client that takes an `id` string and returns the `data` object
## Installation & Examples
### Install via npm
On your [Astro](https://astro.build) project:
```
npm i @ayco/astro-resume
```
### Usage
Serializing and deserializing basic primitive data
```astro
---
import Serialize from "@ayco/astro-resume";
const data = {
hello: 'world',
}
---
```
### Type Safety
You can define a type for the data and use it in the client script.
```astro
---
import Serialize from "@ayco/astro-resume";
const data = {
hello: 'world',
isOkay: true
}
// define the type of data to be serialized
export type Data = typeof data;
---
```
### Passing all Astro.props to client
If you need to make all the component props to the client script:
```astro
---
import Serialize from "@ayco/astro-resume";
export interface Props {
hello: string;
isOkay: boolean;
}
---
```
## What's happening here?
This is a quick and easy pattern to embed serialized information into your HTML and make it available in the client-side script with type safety.
The `Serialize` component will write the data as JSON wrapped in a `