users.map(user => {
return <BooksInfo key={user.id} bookname={user.bookname} writer={user.writer}
publishingcompany={user.publishingcompany} number={user.number} ISBN={user.ISBN}
chdtjaud={user.chdtjaud} qnsfbrlgh={user.qnsfbrlgh} isDeleted={user.isDeleted} />
제가 app.js에서 이렇게 쓴 다음
BooksInfo로 저 users의 정보를 가져오고 싶은데
import { React, useState, useEffect } from 'react';
import axios from 'axios';
import TableRow from '@material-ui/core/TableRow';
import TableCell from '@material-ui/core/TableCell';
function BooksInfo() {
return (
<TableRow key={this.id}>
<TableCell>{this.bookname}</TableCell>
<TableCell>{this.writer}</TableCell>
<TableCell>{this.publishingcompany}</TableCell>
<TableCell>{this.number}</TableCell>
<TableCell>{this.ISBN}</TableCell>
<TableCell>{this.chdtjaud}</TableCell>
<TableCell>{this.qnsfbrlgh}</TableCell>
<TableCell>{this.isDeleted}</TableCell>
</TableRow>
)
}
export default BooksInfo;
이런식으로 넘길 순 없는건가요
제가 클래스형으로 따라해보다가 함수형으로 바꿔보고 싶어져서 해보는건데
ㅠㅠ 모르겠습니다 너무 기초적인거 같지만 여쭤보아요
function BookInfo(props){ return( 태그열기TableRow key 태그닫기 태그열기 TableCell태그닫기 {props.bookname} 닫힘태그열기 TableCell 태그닫기 ) } 로 해보세요 BooksInfo에 넘겨준 props들을 BooksInfo에서 props로 받아서 사용. TableRow의 key={props.key}인 이유는 첫번째 사진에서 id에 대한 props이름이 key로 되어있기때문 처음댓글다는데 엔터하면 바로 댓글달리네;; 태그도 공격들어올까봐 막아놨나보네 아이고야
아이고 감사합니다 .. 진짜 진짜 간단한거 였네요 ...... 감사합니다 !!