-
글쓴이글
-
2021년 10월 29일 23:09 #18818
김준성참가자왜 이런 오류가 발생 할까요?
data.js
export default [
{
id: 0,
title: "White and Black",
content: "Born in France",
price: 120000,
},
{
id: 1,
title: "Red Knit",
content: "Born in Seoul",
price: 110000,
},
{
id: 2,
title: "Grey Yordan",
content: "Born in the States",
price: 130000,
},
];App.js
import React, { useState } from "react";
import { Navbar, Container, Nav, NavDropdown } from "react-bootstrap";
import "./App.css";
import Data from "./data.js";function App() {
let [shoes, shoes변경] = useState(Data);return (
<div className="App">
<Navbar bg="light" expand="lg">
<Container>
<Navbar.Brand href="#home">React-Bootstrap</Navbar.Brand>
<Navbar.Toggle aria-controls="basic-navbar-nav" />
<Navbar.Collapse id="basic-navbar-nav">
<Nav className="me-auto">
<Nav.Link href="#home">Home</Nav.Link>
<Nav.Link href="#link">Link</Nav.Link>
<NavDropdown title="Dropdown" id="basic-nav-dropdown">
<NavDropdown.Item href="#action/3.1">Action</NavDropdown.Item>
<NavDropdown.Item href="#action/3.2">
Another action
</NavDropdown.Item>
<NavDropdown.Item href="#action/3.3">
Something
</NavDropdown.Item>
<NavDropdown.Divider />
<NavDropdown.Item href="#action/3.4">
Separated link
</NavDropdown.Item>
</NavDropdown>
</Nav>
</Navbar.Collapse>
</Container>
</Navbar><div class="jumbotron">
<h1 class="display-4">20% Season Off</h1>
<p class="lead">
This is a simple hero unit, a simple jumbotron-style component for
calling extra attention to featured content or information.
</p>
<hr class="my-4" />
<p>
It uses utility classes for typography and spacing to space content
out within the larger container.
</p>
<p class="lead">
<a class="btn btn-primary btn-lg" href="#" role="button">
Learn more
</a>
</p>
</div>
<div className="container">
<div className="row">
<div className="col-md-4">
<img
src="https://codingapple1.github.io/shop/shoes1.jpg"
width="100%"
/>
<h4>{shoes}</h4>
<p>상품정보</p>
</div>
<div className="col-md-4">
<img
src="https://codingapple1.github.io/shop/shoes2.jpg"
width="100%"
/>
<h4>상품명</h4>
<p>상품정보</p>
</div>
<div className="col-md-4">
<img
src="https://codingapple1.github.io/shop/shoes3.jpg"
width="100%"
/>
<h4>상품명</h4>
<p>상품정보</p>
</div>
</div>
</div>
</div>
);
}export default App;
2021년 10월 30일 09:56 #18824
codingapple키 마스터<h4>{shoes}</h4>
여기서 shoes는 [{},{},{}] 이렇게 생긴자료라 그렇습니다
html사이에 array나 object를 통째로 직접 넣을 순 없습니다
-
글쓴이글
- 답변은 로그인 후 가능합니다.