Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit 62c5a55

Browse files
committed
added razzle example
1 parent 9247b88 commit 62c5a55

File tree

29 files changed

+9881
-27
lines changed

29 files changed

+9881
-27
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package-lock.json
55
coverage
66
.tgz
77
.changelog
8+
cache
89

910
# Differs on each engine
1011
yalc.lock

examples/nextjs/develop/clock/components/Clock.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import { useAgile } from '@agile-ts/react';
23
import { LAST_UPDATED_TIMESTAMP, LIGHT } from '../src/core';
34

examples/nextjs/develop/clock/components/Counter.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import { useAgile } from '@agile-ts/react';
23
import {
34
COUNTER,

examples/nextjs/develop/clock/components/Nav.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import Link from 'next/link';
23

34
const Nav = () => {

examples/nextjs/develop/clock/components/Page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import useInterval from '../src/useInterval';
23
import Nav from './Nav';
34
import Clock from './Clock';

examples/nextjs/develop/clock/pages/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import Page from '../components/Page';
23

34
export default function Index() {

examples/nextjs/develop/clock/pages/ssg.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import Page from '../components/Page';
23
import { COUNTER, LAST_UPDATED_TIMESTAMP, LIGHT } from '../src/core';
34

examples/nextjs/develop/clock/pages/ssr.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import Page from '../components/Page';
23
import { LIGHT, COUNTER, LAST_UPDATED_TIMESTAMP, tick } from '../src/core';
34

examples/nextjs/develop/clock/src/useInterval.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { useEffect, useRef } from 'react';
22

33
// https://overreacted.io/making-setinterval-declarative-with-react-hooks/
4-
const useInterval = (callback, delay) => {
4+
const useInterval = (callback: () => void, delay: number) => {
55
const activeCallback = useRef();
66

77
useEffect(() => {
8-
activeCallback.current = callback;
8+
activeCallback.current = callback as any;
99
}, [callback]);
1010

1111
useEffect(() => {
Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
import {useAgile} from "@agile-ts/react";
2-
import {COUNTER, incrementCount, decrementCount, resetCount} from "../src/core";
1+
import React from 'react';
2+
import { useAgile } from '@agile-ts/react';
3+
import {
4+
COUNTER,
5+
incrementCount,
6+
decrementCount,
7+
resetCount,
8+
} from '../src/core';
39

410
const Counter = () => {
5-
const count = useAgile(COUNTER);
11+
const count = useAgile(COUNTER);
612

7-
return (
8-
<div>
9-
<h1>
10-
Count: <span>{count}</span>
11-
</h1>
12-
<button onClick={incrementCount}>+1</button>
13-
<button onClick={decrementCount}>-1</button>
14-
<button onClick={resetCount}>Reset</button>
15-
</div>
16-
)
17-
}
13+
return (
14+
<div>
15+
<h1>
16+
Count: <span>{count}</span>
17+
</h1>
18+
<button onClick={incrementCount}>+1</button>
19+
<button onClick={decrementCount}>-1</button>
20+
<button onClick={resetCount}>Reset</button>
21+
</div>
22+
);
23+
};
1824

1925
export default Counter;

0 commit comments

Comments
 (0)