マイクロソフト系技術情報 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。

目次

概要

https://github.com/OpenTouryoProject/SampleProgram/tree/master/Template/SPATemplate/ReactTemplate/

構成

フォルダ

ReactTemplate
 ├ ClientApp
 |  ├ components
 |  |  ├ Counter.tsx
 |  |  ├ FetchData.tsx
 |  |  ├ Home.tsx
 |  |  ├ Layout.tsx
 |  |  └ NavMenu.tsx
 |  ├ css
 |  |  └ site.css
 |  ├ boot.tsx
 |  └ routes.tsx
 ├ Controllers
 |  ├ HomeController.cs
 |  └ SampleDataController.cs
 ├ Views
 |  ├ Home
 |  |  └ Index.cshtml
 |  ├ Shared
 |  |  ├ _Layout.cshtml
 |  |  └ Error.cshtml
 |  ├ _ViewImports.cshtml
 |  └ _ViewStart.cshtml
 ├ wwwroot
 |  └ favicon.ico
 ├ .gitignore
 ├ appsettings.Development.json
 ├ appsettings.json
 ├ npm-shrinkwrap.json
 ├ package.json
 ├ Program.cs
 ├ ReactTemplate.csproj
 ├ Startup.cs
 ├ tsconfig.json
 ├ webpack.config.js
 └ webpack.config.vendor.js

スタック

Node.js、React、TypeScript、webpackからなる。

詳細

Index.cshtml(土台)

https://github.com/OpenTouryoProject/SampleProgram/tree/master/Template/SPATemplate/ReactTemplate/Views/Home/Index.cshtml

boot.tsx(EntryPoint?

https://github.com/OpenTouryoProject/SampleProgram/tree/master/Template/SPATemplate/ReactTemplate/ClientApp/boot.tsx

Index.cshtml(土台)」の「<div id="react-app">」の部分に、routesのコンテンツをロードする。

import

Node.jsのモジュールのインポート

renderApp

routes.tsx(URLとDOMの紐付け)

https://github.com/OpenTouryoProject/SampleProgram/tree/master/Template/SPATemplate/ReactTemplate/ClientApp/routes.tsx

概要

表示

各コンポーネント

Layout.tsx

https://github.com/OpenTouryoProject/SampleProgram/tree/master/Template/SPATemplate/ReactTemplate/ClientApp/components/Layout.tsx

NavMenu?.tsx

https://github.com/OpenTouryoProject/SampleProgram/tree/master/Template/SPATemplate/ReactTemplate/ClientApp/components/NavMenu.tsx

Home .tsx

https://github.com/OpenTouryoProject/SampleProgram/tree/master/Template/SPATemplate/ReactTemplate/ClientApp/components/Home.tsx

Counter.tsx

https://github.com/OpenTouryoProject/SampleProgram/tree/master/Template/SPATemplate/ReactTemplate/ClientApp/components/Counter.tsx

カウントアップ処理のテスト画面のHTMLを返す。

FetchData?.tsx

https://github.com/OpenTouryoProject/SampleProgram/tree/master/Template/SPATemplate/ReactTemplate/ClientApp/components/FetchData.tsx

WebAPIからデータを取得しリスト表示する処理のテスト画面のHTMLを返す。

参考

Visual Studio CodeによるSPA開発

開発基盤部会 Wiki

JavaScript - React

この処理を、create-react-appで作成し、掘り下げを行う。


Tags: :.NET開発, :.NET Core, :ASP.NET, :ASP.NET Web API, :ASP.NET SPA, :JavaScript


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS