Skip to content

Commit bd43cef

Browse files
committed
Add posts state and default array value
1 parent 4f088c4 commit bd43cef

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

src/App.js

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,42 @@ import './App.css';
33
import Input from './components/Input'
44
import Post from './components/Post'
55

6-
function App() {
6+
const DEFAULT_POSTS = [
7+
{
8+
id: 0,
9+
username: 'brian',
10+
text: 'Weather is so good rn'
11+
},
12+
{
13+
id: 0,
14+
username: 'brian',
15+
text: 'Weather is bad'
16+
},
17+
{
18+
id: 0,
19+
username: 'brian',
20+
text: 'asdklfkjasldkfjalksdjf'
21+
},
22+
{
23+
id: 0,
24+
username: 'brian',
25+
text: '2o35462098345709283457'
26+
},
27+
]
728

8-
const [count, setCount] = useState(0)
29+
function App() {
930

10-
const posts = [
11-
{
12-
id: 0,
13-
username: 'brian',
14-
text: 'Weather is so good rn'
15-
},
16-
{
17-
id: 0,
18-
username: 'brian',
19-
text: 'Weather is bad'
20-
},
21-
{
22-
id: 0,
23-
username: 'brian',
24-
text: 'asdklfkjasldkfjalksdjf'
25-
},
26-
{
27-
id: 0,
28-
username: 'brian',
29-
text: '2o35462098345709283457'
30-
},
31-
]
31+
const [posts, setPosts] = useState(DEFAULT_POSTS)
3232

3333
return (
3434
<div className="appContainer">
3535
<div className="nav">
3636
<img className="logo" alt="logo" src="https://img.freepik.com/free-vector/twitter-new-2023-x-logo-white-background-vector_1017-45422.jpg?size=338&ext=jpg&ga=GA1.1.1700460183.1712016000&semt=ais" />
3737
</div>
38-
<Input count={count} setCount={setCount} />
38+
<Input />
3939
<div className="postContainer">
4040
{posts.map((post) => <Post post={post} />)}
4141
</div>
42-
<p>{count}</p>
4342
</div>
4443
);
4544
}

0 commit comments

Comments
 (0)