This is a simple example of a React component.
24 | 25 |Current count: {this.state.currentCount}
26 | 27 | 28 |Date | 22 |Temp. (C) | 23 |Temp. (F) | 24 |Summary | 25 |
---|---|---|---|
{forecast.date} | 31 |{forecast.temperatureC} | 32 |{forecast.temperatureF} | 33 |{forecast.summary} | 34 |
Loading...
44 | : FetchData.renderForecastsTable(this.state.forecasts); 45 | 46 | return ( 47 |This component demonstrates fetching data from the server.
50 | {contents} 51 |Welcome to your new single-page application, built with:
11 |To help you get started, we have also set up:
17 |create-react-app
runs in the background automatically, so your client-side resources are dynamically built on demand and the page refreshes when you modify any file.dotnet publish
configuration produces minified, efficiently bundled JavaScript files.The ClientApp
subdirectory is a standard React application based on the create-react-app
template. If you open a command prompt in that directory, you can run npm
commands such as npm test
or npm install
.
13 | Request ID: @Model.RequestId
14 |
19 | Swapping to the Development environment displays detailed information about the error that occurred. 20 |
21 |22 | The Development environment shouldn't be enabled for deployed applications. 23 | It can result in displaying sensitive information from exceptions to end users. 24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 25 | and restarting the app. 26 |
27 | -------------------------------------------------------------------------------- /Pages/Error.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.AspNetCore.Mvc.RazorPages; 3 | using System.Diagnostics; 4 | 5 | namespace ASPNETReact.Pages 6 | { 7 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] 8 | public class ErrorModel : PageModel 9 | { 10 | private readonly ILogger