Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
survey
Commits
622eecb4
Commit
622eecb4
authored
Jan 03, 2023
by
Yoon, Daeki
😅
Browse files
불필요한 파일 제거 및 필요한 패키지 설치
parent
928486a6
Changes
21
Hide whitespace changes
Inline
Side-by-side
frontend/src/forms/RRadio.tsx
View file @
622eecb4
import
React
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
Pie
}
from
"
../charts/pies/Pie
"
;
import
{
IQuestionData
}
from
"
../types
"
;
import
{
IQuestionData
}
from
"
../types
"
;
type
Props
=
{
type
Props
=
{
...
@@ -6,6 +7,8 @@ type Props = {
...
@@ -6,6 +7,8 @@ type Props = {
};
};
export
const
RRadio
=
({
question
}:
Props
)
=>
{
export
const
RRadio
=
({
question
}:
Props
)
=>
{
const
[
dataset
,
setDataset
]
=
useState
([
50
,
30
,
12
,
5
,
3
]);
const
result
=
question
.
answers
.
reduce
((
acc
:
any
,
cur
:
any
)
=>
{
const
result
=
question
.
answers
.
reduce
((
acc
:
any
,
cur
:
any
)
=>
{
acc
[
cur
]
=
(
acc
[
cur
]
||
0
)
+
1
;
acc
[
cur
]
=
(
acc
[
cur
]
||
0
)
+
1
;
return
acc
;
return
acc
;
...
@@ -22,6 +25,7 @@ export const RRadio = ({ question }: Props) => {
...
@@ -22,6 +25,7 @@ export const RRadio = ({ question }: Props) => {
</
span
>
</
span
>
</
div
>
</
div
>
))
}
))
}
<
Pie
data
=
{
dataset
}
/>
</
div
>
</
div
>
);
);
};
};
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment