Skip to content

A template for .net framework based web application with React JS and Typescript

Notifications You must be signed in to change notification settings

rameshkunwar/ReactJSDotNetFramework_TypeScript

Repository files navigation

React JS with Typescript template source for ASP.NET MVC/Web API (.net framework 4.x.x).

With React JS 17.x.x, WebPack 5 and Typescript 4.x.x.x

This template intends to replace asp.net mvc's view with React JS

React JS project is not bootstraped with CRA(create react app).

Webpack is configured in a way it injects scripts and styles inside _Layout.cshtml based on a template file _Template.cshtml.

Webpack splits the output bundle as well as hashed name is used to force the browser to reload if any changes has been made.

Installation

  1. Install all Nuget packages by right-clicking the Solution (on Visual Studio) and selecting Restore Nuget Packages.
  2. React dependencies:
    • Go to the root folder, which is wwwroot on the command prompt or can also be done using Visual Studio Code. Right-click the folder wwwroot and select Open With Code. Use Visual Studio Code to run npm install
    • Alternatively, open wwwroot on command prompt and type 'npm install'

Running

  1. On Visual Studio Code terminal or command prompt, type npm run start for development or npm run build for production.
  2. Hit F5 on Visual Studio to run IIS Express.
  3. Application will be loaded in the choosen browser (in Visual Studio).

Remember, I have used two names above Visual Studio and Visual Studio Code!

I recommend using Visual Studio Code for front-end developement.

Disadvantages of this template

  1. No hot-reloading feature as scripts are injected in _layout.cshtml and uses IIS express as web server rather than webpack dev server.

About

A template for .net framework based web application with React JS and Typescript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published