Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
Triz_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sdy
2020-06-03 23:02:07 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
06f5d222f4e61ff5fd4267025374c92550622806
06f5d222
1 parent
057cfba3
add useEffect
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
front/src/Routes/Chat/ChatPresenter.js
front/src/Routes/Chat/ChatPresenter.js
View file @
06f5d22
import
React
from
"react"
;
import
React
,
{
useEffect
}
from
"react"
;
import
styled
from
"styled-components"
;
import
Header
from
"../../Components/Header"
;
import
Input
from
"../../Components/Input"
;
...
...
@@ -147,9 +147,16 @@ const StyledLink = styled(Link)`
}
`
;
export
default
({
location
,
message
,
onSubmit
,
messageArray
})
=>
{
export
default
({
location
,
message
,
onSubmit
,
messageArray
,
subscribeToNewMessage
,
})
=>
{
const
{
pathname
}
=
location
;
const
roomName
=
pathname
.
slice
(
1
,
pathname
.
length
);
useEffect
(()
=>
subscribeToNewMessage
(),
[]);
return
(
<
Wrapper
>
...
...
@@ -172,6 +179,7 @@ export default ({ location, message, onSubmit, messageArray }) => {
<
Title
>
Selected
Menu
Title
<
/Title
>
<
/ChatScreenHeader
>
<
ChatScreenBox
>
<
ul
>
{
messageArray
&&
messageArray
.
seeAllMessage
.
map
((
e
)
=>
(
<
Message
...
...
@@ -181,6 +189,7 @@ export default ({ location, message, onSubmit, messageArray }) => {
avatar
=
{
e
.
sender
.
avatarUrl
}
/
>
))}
<
/ul
>
<
InputContainer
className
=
"InputContainer"
>
<
form
onSubmit
=
{
onSubmit
}
>
<
Input
...
...
Please
register
or
login
to post a comment