Skip to content

Commit

Permalink
merge /examples/ssr-spa/ into /examples/basic/
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Apr 8, 2024
1 parent e12c087 commit a6ec7e8
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 323 deletions.
1 change: 1 addition & 0 deletions examples/basic/layouts/LayoutDefault.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function LayoutDefault({ children }: { children: React.ReactNode }) {
<Link href="/">Welcome</Link>
<Link href="/star-wars">Data Fetching</Link>
<Link href="/streaming">HTML Streaming</Link>
<Link href="/without-ssr">Without SSR</Link>
</Sidebar>
<Content>{children}</Content>
</div>
Expand Down
10 changes: 6 additions & 4 deletions examples/basic/pages/+config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import vikeReact from 'vike-react/config'

// Default configs (can be overridden by pages)
const config = {
Layout: LayoutDefault,
Head: HeadDefault,
// <title>
title: 'My Vike + React App',
// Enable HTML streaming (https://vike.dev/stream)
stream: true,
Head: HeadDefault,
// https://vike.dev/Layout
Layout: LayoutDefault,
// https://vike.dev/ssr - this line can be removed since `true` is the default
ssr: true,
// https://vike.dev/extends
extends: vikeReact
} satisfies Config
3 changes: 3 additions & 0 deletions examples/basic/pages/index/+Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import React from 'react'
import { Counter } from '../../components/Counter'

function Page() {
// Will be printed on the server and in the browser:
console.log('Rendering the landing page')

return (
<>
<h1>My Vike + React app</h1>
Expand Down
22 changes: 22 additions & 0 deletions examples/basic/pages/without-ssr/+Page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export default Page

import React from 'react'
import { Counter } from '../../components/Counter'

function Page() {
// Will be printed only in the browser:
console.log('Rendering page without SSR')

return (
<>
<h1>Without SSR</h1>
This page is rendered only in the browser:
<ul>
<li>
Interactive. <Counter />
</li>
<li>It isn't rendered to HTML.</li>
</ul>
</>
)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Config } from 'vike/types'

export default {
ssr: false // SPA
// https://vike.dev/ssr
ssr: false
} satisfies Config
3 changes: 2 additions & 1 deletion examples/basic/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ Full-fledged example of using `vike-react`, showcasing:

- [Layout](https://vike.dev/Layout)
- Fetching data with [`data()`](https://vike.dev/data)
- [Error page](https://vike.dev/error-page)
- [Toggling SSR](https://vike.dev/ssr) on a per-page basis.
- [HTML Streaming](https://vike.dev/streaming)
- [Error page](https://vike.dev/error-page)

```bash
git clone git@github.com:vikejs/vike-react
Expand Down
2 changes: 0 additions & 2 deletions examples/ssr-spa/.gitignore

This file was deleted.

36 changes: 0 additions & 36 deletions examples/ssr-spa/assets/logo.svg

This file was deleted.

15 changes: 0 additions & 15 deletions examples/ssr-spa/components/Link.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions examples/ssr-spa/layouts/HeadDefault.tsx

This file was deleted.

75 changes: 0 additions & 75 deletions examples/ssr-spa/layouts/LayoutDefault.tsx

This file was deleted.

29 changes: 0 additions & 29 deletions examples/ssr-spa/layouts/style.css

This file was deleted.

20 changes: 0 additions & 20 deletions examples/ssr-spa/package.json

This file was deleted.

14 changes: 0 additions & 14 deletions examples/ssr-spa/pages/+config.ts

This file was deleted.

23 changes: 0 additions & 23 deletions examples/ssr-spa/pages/_error/+Page.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions examples/ssr-spa/pages/index/+Page.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions examples/ssr-spa/pages/spa/+Page.tsx

This file was deleted.

9 changes: 0 additions & 9 deletions examples/ssr-spa/readme.md

This file was deleted.

13 changes: 0 additions & 13 deletions examples/ssr-spa/tsconfig.json

This file was deleted.

7 changes: 0 additions & 7 deletions examples/ssr-spa/vite.config.ts

This file was deleted.

Loading

0 comments on commit a6ec7e8

Please sign in to comment.