Skip to content
Snippets Groups Projects
Article.js 736 B
import React, {useEffect, useState} from "react";

import { useParams } from 'react-router-dom';

function Article(prop) {

  console.log(prop)
  let listItem = []
  listItem = prop.images.map((el)=>{
    // http://localhost:8080/uploads/21701487062905.png
    return(
      <img
        src={`http://localhost:8080/${el.replaceAll("\\", "/").substring(7)}`}
        alt={`http://localhost:8080/${el.replaceAll("\\", "/").substring(7)}`}
        style={{ width: "100px", height: "100px"}}/>
    )});
    

  return (
    <div>
      <h1>{prop.title}</h1>
      <h2>{prop.author}</h2>
      <p>{prop.content}</p>
      <p>{listItem}</p>
      {/* 게시글의 내용을 렌더링합니다. */}
    </div>
  );
}

export default Article;