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
messenger
Commits
f4bae50f
Commit
f4bae50f
authored
Jan 15, 2021
by
JeongYeonwoo
Browse files
merge
parent
952a6040
Changes
1
Hide whitespace changes
Inline
Side-by-side
client/src/Components/Chat.js
View file @
f4bae50f
...
@@ -3,8 +3,8 @@ import { Form, Button, Row } from 'react-bootstrap';
...
@@ -3,8 +3,8 @@ import { Form, Button, Row } from 'react-bootstrap';
function
Chat
(
props
)
{
function
Chat
(
props
)
{
let
defaultname
=
''
//
let defaultname=''
//
let defaultname = sessionStorage.getItem('name');
let
defaultname
=
sessionStorage
.
getItem
(
'
name
'
);
const
[
inner
,
setInner
]
=
useState
([
''
])
const
[
inner
,
setInner
]
=
useState
([
''
])
const
[
chat
,
setChat
]
=
useState
([
inner
])
//object로 key는 보낸사람 value는 메세지
const
[
chat
,
setChat
]
=
useState
([
inner
])
//object로 key는 보낸사람 value는 메세지
...
@@ -32,7 +32,7 @@ function Chat(props) {
...
@@ -32,7 +32,7 @@ function Chat(props) {
<
h2
>
현재
{
props
.
roomName
}
입니다
.
<
/h2
>
<
h2
>
현재
{
props
.
roomName
}
입니다
.
<
/h2
>
{
chat
.
map
((
value
,
index
)
=>
(
{
chat
.
map
((
value
,
index
)
=>
(
<
Row
key
=
{
index
}
className
=
'
ml-3
'
>
<
Row
key
=
{
index
}
className
=
'
ml-3
'
>
{
props
.
roomName
}
에서
{
props
.
namelist
}
님이
보낸
메세지
:
{
value
}
{
props
.
roomName
}
에서
{
defaultname
}
님이
보낸
메세지
:
{
value
}
<
/Row
>
<
/Row
>
))}
))}
<
Button
variant
=
"
light
"
onClick
=
{
props
.
handleChatc
}
>
{
`<`
}
<
/Button
>
<
Button
variant
=
"
light
"
onClick
=
{
props
.
handleChatc
}
>
{
`<`
}
<
/Button
>
...
...
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