Skip to content

Commit 229a965

Browse files
committed
2-DR2-TP2.06
1 parent 0acd174 commit 229a965

File tree

1 file changed

+6
-9
lines changed
  • 2-desenvolvimento-front-end/DR2-fundamentos-de-react/DR2-TP2.00-biblioteca-crud/src

1 file changed

+6
-9
lines changed
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
import { useState } from 'react'
12
import './App.css'
23
import Header from './components/header'
34
import BookForm from './components/bookform'
45
import BookList from './components/booklist'
56

67
function App() {
7-
const livros = retornaLivros();
8+
const [livros, setLivros] = useState([
9+
{ titulo: "A Menina que Roubava Livros", autor: "Markus Zusak", ano: 2005 },
10+
{ titulo: "Admirável Mundo Novo", autor: "Aldous Huxley", ano: 1932 },
11+
{ titulo: "O Senhor dos Anéis", autor: "J.R.R. Tolkien", ano: 1954 }
12+
]);
813

914
return (
1015
<>
@@ -17,12 +22,4 @@ function App() {
1722
)
1823
}
1924

20-
function retornaLivros() {
21-
return [
22-
{ titulo: "A Menina que Roubava Livros", autor: "Markus Zusak", ano: 2005 },
23-
{ titulo: "Admirável Mundo Novo", autor: "Aldous Huxley", ano: 1932 },
24-
{ titulo: "O Senhor dos Anéis", autor: "J.R.R. Tolkien", ano: 1954 }
25-
]
26-
}
27-
2825
export default App

0 commit comments

Comments
 (0)