You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
819 B
25 lines
819 B
/**
|
|
* アプリケーションのエントリーポイント
|
|
* Reactアプリケーションの初期化とルートコンポーネントのレンダリングを行う
|
|
*/
|
|
import React from 'react';
|
|
import { createRoot } from 'react-dom/client';
|
|
import './index.css';
|
|
import App from './App';
|
|
|
|
// DOMからルート要素を取得
|
|
const container = document.getElementById('root');
|
|
if (!container) {
|
|
// ルート要素が見つからない場合はエラーをスロー
|
|
throw new Error('Failed to find the root element');
|
|
}
|
|
|
|
// React 18のcreateRootAPIを使用してルートを作成
|
|
const root = createRoot(container);
|
|
// Appコンポーネントをレンダリング
|
|
// StrictModeで囲むことで開発時の潜在的な問題を検出
|
|
root.render(
|
|
<React.StrictMode>
|
|
<App />
|
|
</React.StrictMode>
|
|
);
|
|
|