component

Electron

componentファイルの置き場所

【Electron】不明

【React単体】public/src/component

複数のファイルで使用する共通部品はcomponentフォルダにまとめておくこと

public/src/component/Card.jsx

import React from 'react';

const Card = (props) => {
  return(
    <article>
      <h3>{props.title}</h3>
      <p>{props.description}</p>
    </article>
  );
}

// 名前なしExport
export default Card;

public/src/Home.jsx

import Card from './component/Card';

const Home = () => {
  return (
    <>
      <Card
        title={'タイトル'}
        description={'説明文'}
      />
    </>
  );
}
BACK