-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAsyncCounter.tsx
More file actions
27 lines (24 loc) · 880 Bytes
/
AsyncCounter.tsx
File metadata and controls
27 lines (24 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (c) 2020 Gonzalo Müller Bravo.
import * as React from 'react'
import { DeepReadonly } from 'deep-freeze'
import { Link } from 'react-router-dom'
import { AsyncReducerProvider } from 'react-reducer-provider'
import { CounterContainer } from './CounterContainer'
import { CounterState } from './CounterState'
import { reduce } from './CounterActions'
interface Props {
title: string;
counterId: string;
initialState: CounterState;
}
export function AsyncCounter({ title, counterId, initialState }: DeepReadonly<Props>): React.ReactElement {
return (
<AsyncReducerProvider id={counterId} reducer={reduce} initialState={initialState}>
<div className='title'>{title}</div>
<CounterContainer counterId={counterId}/>
<Link to='/' className='button is-link is-small is-outlined'>
Home
</Link>
</AsyncReducerProvider>
)
}