-
Notifications
You must be signed in to change notification settings - Fork 0
/
Selection.js
46 lines (42 loc) · 1.04 KB
/
Selection.js
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
35
36
37
38
39
40
41
42
43
44
45
46
import React from 'react'
import { Form, Checkbox } from 'semantic-ui-react'
import Question from './Question';
import ArticleSection from './Article';
function Selection() {
const [value, setValue] = React.useState('Question')
return (
<>
<Form>
<Form.Field>
Selected value: <b>{value}</b>
</Form.Field>
<Form.Field>
<Checkbox
radio
label='Question'
name='checkboxRadioGroup'
value='Question'
checked={value === 'Question'}
onChange={(e, data) => setValue(data.value)}
/>
</Form.Field>
<Form.Field>
<Checkbox
radio
label='Article'
name='checkboxRadioGroup'
value='Article'
checked={value === 'Article'}
onChange={(e, data) => setValue(data.value)}
/>
</Form.Field>
</Form>
{value === 'Question' ? (
<Question />
) : (
<ArticleSection />
)}
</>
)
}
export default Selection;