Skip to content

Commit e31a698

Browse files
christianalfonigitbook-bot
authored andcommitted
GitBook: [master] one page modified
1 parent 2ae43e2 commit e31a698

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

guides-1/connecting-components.md

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ By installing the view layer of choice you will be able to connect it to your Ov
66

77
{% tabs %}
88
{% tab title="React" %}
9-
{% code title="App.tsx" %}
9+
{% code title="App.jsx" %}
1010
```typescript
1111
import * as React from 'react'
1212
import { useOvermind } from '../../overmind'
1313

14-
const App: React.FunctionComponent = () => {
14+
const App = () => {
1515
const { state } = useOvermind()
1616

1717
if (state.isLoading) {
@@ -83,7 +83,7 @@ When we just access an array in a component it will re-render if the array itsel
8383
import * as React from 'react'
8484
import { useOvermind } from '../overmind'
8585

86-
const List: React.FunctionComponent = () => {
86+
const List = () => {
8787
const { state } = useOvermind()
8888

8989
return (
@@ -130,7 +130,7 @@ But what happens if we iterate the array and access a property on each item?
130130
import * as React from 'react'
131131
import { useOvermind } from '../overmind'
132132

133-
const List: React.FunctionComponent = () => {
133+
const List = () => {
134134
const { state } = useOvermind()
135135

136136
return (
@@ -196,7 +196,7 @@ Objects are similar to arrays. If you access an object you track if that object
196196
import * as React from 'react'
197197
import { useOvermind } from '../overmind'
198198

199-
const List: React.FunctionComponent = () => {
199+
const List = () => {
200200
const { state } = useOvermind()
201201

202202
return (
@@ -239,16 +239,12 @@ And just like an array you can iterate the object keys to pass items to a child
239239

240240
{% tabs %}
241241
{% tab title="React" %}
242-
{% code title="Item.tsx" %}
242+
{% code title="Item.jsx" %}
243243
```typescript
244244
import * as React from 'react'
245245
import { useOvermind } from '../overmind'
246246

247-
type Props = {
248-
item: { title: string }
249-
}
250-
251-
const Item: React.FunctionComponent<Props> = ({ item }) => {
247+
const Item = ({ item }) => {
252248
useOvermind()
253249

254250
return (
@@ -301,13 +297,13 @@ export default {
301297

302298
{% tabs %}
303299
{% tab title="React" %}
304-
{% code title="List.tsx" %}
300+
{% code title="List.jsx" %}
305301
```typescript
306302
import * as React from 'react'
307303
import { useOvermind } from '../overmind'
308304
import Item from './Item'
309305

310-
const List: React.FunctionComponent = () => {
306+
const List = () => {
311307
const { state } = useOvermind()
312308

313309
return (
@@ -373,11 +369,9 @@ export default {
373369
All the actions defined in the Overmind application are available to connected components.
374370

375371
{% tabs %}
376-
{% tab title="overmind/actions.ts" %}
372+
{% tab title="overmind/actions.js" %}
377373
```typescript
378-
import { Action } from 'overmind'
379-
380-
export const toggleAwesomeApp: Action = ({ state }) =>
374+
export const toggleAwesomeApp = ({ state }) =>
381375
state.isAwesome = !state.isAwesome
382376
```
383377
{% endtab %}
@@ -389,7 +383,7 @@ export const toggleAwesomeApp: Action = ({ state }) =>
389383
import * as React from 'react'
390384
import { useOvermind } from '../overmind'
391385

392-
const App: React.FunctionComponent = () => {
386+
const App = () => {
393387
const { actions } = useOvermind()
394388

395389
return (
@@ -450,7 +444,7 @@ This example shows how you can scroll to the top of the page every time you chan
450444
import * as React from 'react'
451445
import { useOvermind } from '../../overmind'
452446

453-
const Article: React.FunctionComponent = () => {
447+
const Article = () => {
454448
const { reaction } = useOvermind()
455449

456450
React.useEffect(() => reaction(

0 commit comments

Comments
 (0)