@ereo/client 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +25 -9
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -11,20 +11,36 @@ bun add @ereo/client
11
11
  ## Quick Start
12
12
 
13
13
  ```typescript
14
- import { initClient, Link, useLoaderData } from '@ereo/client';
14
+ // app/entry.client.ts
15
+ import { initClient } from '@ereo/client';
15
16
 
16
- // Initialize the client runtime
17
+ // Initialize the client runtime (hydrates islands, navigation, prefetching)
17
18
  initClient();
19
+ ```
20
+
21
+ ### Data Access
22
+
23
+ Route components receive `loaderData` and `actionData` as props during SSR:
24
+
25
+ ```tsx
26
+ // app/routes/users.tsx
27
+ export async function loader() {
28
+ return { users: await db.user.findMany() };
29
+ }
18
30
 
19
- // Use loader data in components
20
- function UserProfile() {
21
- const { user } = useLoaderData<{ user: { name: string } }>();
22
- return <h1>{user.name}</h1>;
31
+ export default function UsersPage({ loaderData }: { loaderData: { users: User[] } }) {
32
+ return <ul>{loaderData.users.map(u => <li key={u.id}>{u.name}</li>)}</ul>;
23
33
  }
34
+ ```
35
+
36
+ For nested or child components, use hooks to access data without prop drilling:
37
+
38
+ ```tsx
39
+ import { useLoaderData } from '@ereo/client';
24
40
 
25
- // Client-side navigation with prefetching
26
- function Nav() {
27
- return <Link to="/dashboard" prefetch="intent">Dashboard</Link>;
41
+ function UserCount() {
42
+ const { users } = useLoaderData<{ users: User[] }>();
43
+ return <span>{users.length} users</span>;
28
44
  }
29
45
  ```
30
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ereo/client",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "license": "MIT",
5
5
  "author": "Ereo Team",
6
6
  "homepage": "https://ereojs.github.io/ereoJS",
@@ -32,7 +32,7 @@
32
32
  "typecheck": "tsc --noEmit"
33
33
  },
34
34
  "dependencies": {
35
- "@ereo/core": "^0.2.6"
35
+ "@ereo/core": "^0.2.8"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/react": "^18.2.0",