mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Templates: update React's component's State and Property type
This commit is contained in:
@@ -7,7 +7,7 @@ import * as WeatherForecasts from '../store/WeatherForecasts';
|
|||||||
|
|
||||||
type CounterProps = CounterStore.CounterState & typeof CounterStore.actionCreators;
|
type CounterProps = CounterStore.CounterState & typeof CounterStore.actionCreators;
|
||||||
|
|
||||||
class Counter extends React.Component<CounterProps, void> {
|
class Counter extends React.Component<CounterProps, {}> {
|
||||||
public render() {
|
public render() {
|
||||||
return <div>
|
return <div>
|
||||||
<h1>Counter</h1>
|
<h1>Counter</h1>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ type WeatherForecastProps =
|
|||||||
& typeof WeatherForecastsState.actionCreators // ... plus action creators we've requested
|
& typeof WeatherForecastsState.actionCreators // ... plus action creators we've requested
|
||||||
& { params: { startDateIndex: string } }; // ... plus incoming routing parameters
|
& { params: { startDateIndex: string } }; // ... plus incoming routing parameters
|
||||||
|
|
||||||
class FetchData extends React.Component<WeatherForecastProps, void> {
|
class FetchData extends React.Component<WeatherForecastProps, {}> {
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
// This method runs when the component is first added to the page
|
// This method runs when the component is first added to the page
|
||||||
let startDateIndex = parseInt(this.props.params.startDateIndex) || 0;
|
let startDateIndex = parseInt(this.props.params.startDateIndex) || 0;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export default class Home extends React.Component<void, void> {
|
export default class Home extends React.Component<{}, {}> {
|
||||||
public render() {
|
public render() {
|
||||||
return <div>
|
return <div>
|
||||||
<h1>Hello, world!</h1>
|
<h1>Hello, world!</h1>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export interface LayoutProps {
|
|||||||
body: React.ReactElement<any>;
|
body: React.ReactElement<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Layout extends React.Component<LayoutProps, void> {
|
export class Layout extends React.Component<LayoutProps, {}> {
|
||||||
public render() {
|
public render() {
|
||||||
return <div className='container-fluid'>
|
return <div className='container-fluid'>
|
||||||
<div className='row'>
|
<div className='row'>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
|
|
||||||
export class NavMenu extends React.Component<any, void> {
|
export class NavMenu extends React.Component<{}, {}> {
|
||||||
public render() {
|
public render() {
|
||||||
return <div className='main-nav'>
|
return <div className='main-nav'>
|
||||||
<div className='navbar navbar-inverse'>
|
<div className='navbar navbar-inverse'>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ interface CounterState {
|
|||||||
currentCount: number;
|
currentCount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Counter extends React.Component<any, CounterState> {
|
export class Counter extends React.Component<{}, CounterState> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.state = { currentCount: 0 };
|
this.state = { currentCount: 0 };
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ interface FetchDataExampleState {
|
|||||||
loading: boolean;
|
loading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FetchData extends React.Component<any, FetchDataExampleState> {
|
export class FetchData extends React.Component<{}, FetchDataExampleState> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.state = { forecasts: [], loading: true };
|
this.state = { forecasts: [], loading: true };
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
export class Home extends React.Component<any, void> {
|
export class Home extends React.Component<{}, {}> {
|
||||||
public render() {
|
public render() {
|
||||||
return <div>
|
return <div>
|
||||||
<h1>Hello, world!</h1>
|
<h1>Hello, world!</h1>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export interface LayoutProps {
|
|||||||
body: React.ReactElement<any>;
|
body: React.ReactElement<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Layout extends React.Component<LayoutProps, void> {
|
export class Layout extends React.Component<LayoutProps, {}> {
|
||||||
public render() {
|
public render() {
|
||||||
return <div className='container-fluid'>
|
return <div className='container-fluid'>
|
||||||
<div className='row'>
|
<div className='row'>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
|
|
||||||
export class NavMenu extends React.Component<any, void> {
|
export class NavMenu extends React.Component<{}, {}> {
|
||||||
public render() {
|
public render() {
|
||||||
return <div className='main-nav'>
|
return <div className='main-nav'>
|
||||||
<div className='navbar navbar-inverse'>
|
<div className='navbar navbar-inverse'>
|
||||||
|
|||||||
Reference in New Issue
Block a user