码迷,mamicode.com
首页 > 其他好文 > 详细

react: typescript integrate withRouter

时间:2019-07-24 20:48:13      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:current   def   div   navigator   pat   fun   const   port   cti   

define interface:

export interface INav {
  nav: string
}

export interface IModuleItem {
  state?: string;
  type?: string;
  uri?: string;
}

use in Function Component:

import {INav} from "./path/to/menu.ts";

const AppNavigator = (props: INav & RouteComponentProps) => {
  const [currentNav, setCurrentNav] = useState<INav>(props.nav);
  ....
}

export default withRouter(AppNavigator);

 

react: typescript integrate withRouter

标签:current   def   div   navigator   pat   fun   const   port   cti   

原文地址:https://www.cnblogs.com/Nyan-Workflow-FC/p/11240695.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!