-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbasic.js
More file actions
34 lines (32 loc) · 862 Bytes
/
Copy pathbasic.js
File metadata and controls
34 lines (32 loc) · 862 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
28
29
30
31
32
33
34
// @flow
import React, { Component } from 'react';
type Animal = 'bird' | 'cat' | 'dog';
type Possession = {
name: string,
value: number
};
type Person = {
name: string
};
type Props = {
alive: boolean,
age: number,
name: string,
love: any,
friends: Array<Person | Animal>,
possessions: Array<Possession>,
homePlanet?: 'Earth' | 'Mars'
};
function PersonComponent(props: Props) {
return (
<div>
<span>Is Alive: { props.alive }</span>
<span>Age: { props.age }</span>
<span>Name: { props.mane }</span>
<span>Loves: { props.love }</span>
<span>Friends: <ul>{ props.friends.map(friend => <li>friend</li>) }</ul></span>
<span>Friends: <ul>{ props.possessions.map(pos => <li>pos.name</li>) }</ul></span>
<span>Home Planet: { props.homePlanet ? props.homePlanet : 'None' }</span>
</div>
);
};