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
travel
Commits
0a4db016
Commit
0a4db016
authored
Jul 27, 2022
by
Lee Soobeom
Browse files
send posting info to board
parent
18f1a3f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/board/board.tsx
View file @
0a4db016
import
React
,
{
useState
,
MouseEvent
,
useEffect
}
from
"
react
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
{
Link
,
useLocation
}
from
"
react-router-dom
"
;
import
{
PostType
}
from
"
../types
"
;
import
Post
from
"
../post/post
"
;
import
{
postApi
}
from
"
../apis
"
;
...
...
@@ -8,11 +8,27 @@ interface Posts {
posts
:
PostType
[];
}
interface
Newpost
{
state
:
PostType
;
}
export
default
function
BoardPage
()
{
const
[
posts
,
setPosts
]
=
useState
<
PostType
[]
>
();
const
location
=
useLocation
()
as
Newpost
;
const
newPost
=
location
.
state
;
// console.log("get newPost Info", newPost);
const
setNewPosts
=
(
newpost
:
PostType
)
=>
{
const
postArr
=
posts
?.
splice
(
-
1
,
0
,
newPost
);
if
(
!
(
postArr
===
undefined
))
{
setPosts
(
postArr
);
}
};
useEffect
(()
=>
{
getDataList
();
setNewPosts
(
newPost
);
},
[]);
// posts
...
...
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