腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(9999+)
视频
沙龙
1
回答
如
何在
react
typescript
中
通过
props
发送
函数
javascript
、
reactjs
、
typescript
我正在尝试用一个按钮组件来做两件事:一个叫做" start“,我想从我的StoreTimer.start()开始倒计时……另一个是" reset“,我想从我的StoreTimer.reset()
中
重置倒计时</div>} export const StartButton: <
浏览 21
提问于2021-10-05
得票数 0
1
回答
对JSS和
TypeScript
进行反应
reactjs
、
typescript
、
jss
我已经使用
React
很长一段时间了,现在我想切换到使用。然而,我已经习惯了JSS风格(
通过
react
-jss包),我不明白我应该如
何在
TypeScript
中使用它们。我将如
何在
TypeScript
中
编写类似上述的内容?: string,} rend
浏览 3
提问于2020-01-06
得票数 5
回答已采纳
11
回答
如何使用
TypeScript
重写受保护的/私有路由并作出反应-路由器4、5或6?
reactjs
、
typescript
、
react-router
、
react-router-dom
、
typescript2.0
我试图创建一个<PrivateRoute>,
如
使用
TypeScript
的
react
路由器中所描述的那样。有人能帮我吗?..rest} render={
props
=> ( <Component {...
props
}/> <Redirect to={{pathname: '/login', state: { from: <em
浏览 9
提问于2017-12-11
得票数 62
回答已采纳
1
回答
包装延迟组件时响应类型记录特殊TypeError
javascript
、
reactjs
、
typescript
、
react-props
、
high-order-component
代码: "dependencies": { "
react
-dom": "^18.1.0","devDependencies":{ "@types/
react
": "^18.0.8&
浏览 12
提问于2022-05-02
得票数 1
3
回答
使用状态与
TypeScript
进行反应
javascript
、
reactjs
、
typescript
我是
TypeScript
的新手。在render方法
中
显示this.state.something或将其赋值给
函数
中
的变量时,我遇到了问题。: string; constructor() { this.state
浏览 4
提问于2017-10-28
得票数 91
回答已采纳
2
回答
样式化组件插值
函数
中出现“在
函数
上缺少返回类型”错误
reactjs
、
typescript
、
eslint
、
styled-components
用于从
props
中提取主题数据的插值
函数
会产生一个“在
函数
上缺少返回类型”。eslint错误。我使用声明合并来输入主题数据,
如
typescript
documentation中所述。合并似乎工作正常,因为
props
.theme是根据我的声明进行类型化的。可以
通过
为插值
函数
指定返回类型来修复此问题 ${(
props
): string =>
props
.theme.colors.secondary} 但我不认为这是
浏览 35
提问于2019-09-09
得票数 5
回答已采纳
2
回答
TypeScript
:是否可以使用interace重写此辅助类型
reactjs
、
typescript
在阅读这篇博客文章https://fettblog.eu/
typescript
-
react
-component-patterns/时,我遇到了这种帮助器类型 type WithChildren<T =:
React
.ReactNode }; title: string; }>; 我们可以
通过
执行以下操作来使用此类型 function
浏览 14
提问于2020-08-09
得票数 0
1
回答
如
何在
使用
TypeScript
的
React
Native
中
结合使用forwardRef和FunctionComponent
javascript
、
reactjs
、
typescript
、
react-native
、
react-hooks
我看过许多文档和示例,但我似乎仍然不太理解如
何在
React
Native中使用带有
TypeScript
的功能组件的forwardRef。下面是一个示例,其中我创建了一个带有自定义
函数
的MyCustomComponent,我尝试
通过
创建ref从父级调用该
函数
。但是,由于ref的定义不正确且为null,我显然收到了一条错误消息,告诉我该
函数
不存在。请帮助我理解如
何在
React
Native中正确使用forwardRef。提前感谢!<
浏览 2
提问于2020-10-23
得票数 12
回答已采纳
7
回答
在
typescript
中
创建自己的
react
路由类
reactjs
、
typescript
、
react-router
、
react-router-v4
我找到了这个()站点,它用一些例子解释了
react
-router。但是我不能用
typescript
类做到这一点。我想要做的是扩展Route类来构建我自己的类。现在,我想在
typescript
中
实现它,以进行身份验证,
如
网站上的以下示例所示。const PrivateRoute = ({ component, ...rest }) => ( fakeAuth.isAuthenticated
浏览 6
提问于2017-02-18
得票数 14
3
回答
React
Javascript到
React
Typescript
的转换
javascript
、
reactjs
、
typescript
import
React
, {Component} from "
react
"; </div>}}export default Counter; 我想将JavaScript
中
的
React
代码更改为<
浏览 15
提问于2021-09-15
得票数 0
2
回答
TypeScript
React
<img /> onLoad event.target找不到naturalWidth naturalHeight
html
、
reactjs
、
image
、
typescript
return <img {...
props
} onLoad={event => {}}/> 我想在
TypeScript
React
中
检索naturalWidth和naturalHeight。但是被卡住了,
TypeScript
找不到那个属性。 如
何在
TypeScript
React
中
检索naturalWidth和naturalH
浏览 49
提问于2019-06-04
得票数 1
回答已采纳
1
回答
Typescript
返回一个
函数
,该
函数
返回具有类型约束组件
typescript
下面是我的代码,但它不能
通过
typescript
验证 import * as
React
from "
react
"; return (
props
: Partial<P> = {} ) => { // Iwant this
浏览 40
提问于2021-01-06
得票数 1
回答已采纳
2
回答
如
何在
Typescript
React
中
迭代组件的子组件?
reactjs
、
typescript
、
react-jsx
、
tsx
如
何在
Typescript
tsx
中
遍历
React
组件的子组件?以下内容将是有效的jsx: return ( {
React
.Children.map(this.
props
.children, x => x.
props
.foo)} );然而,在
Typescript
中</
浏览 0
提问于2015-12-02
得票数 23
回答已采纳
2
回答
Typescript
/
React
: type with function语句中缺少属性“”children“”
reactjs
、
typescript
我有一个接受孩子的
React
组件。获取
Typescript
错误: Property 'children' is missing in type ... but required in type 'FixedWidthLayout' 该组件的定义类似于
函数
语句const FixedWidthLayout:
React
.FC<
Props
> = () => {...} ..is不是一个选项。 如
何在
带有
函数
语句的<em
浏览 65
提问于2020-06-12
得票数 0
回答已采纳
1
回答
字符串合并的类型转换并发症
reactjs
、
typescript
、
react-native
、
typescript-typings
、
react-typescript
我正在尝试创建一个
函数
,根据名称支柱返回JSX。这是我的密码: name: |
React
.ComponentProps<typeof Ionicons>['name'] // '|
React
.ComponentProps<typeof Feather>['name']; // 2000 different strings...<Fe
浏览 6
提问于2021-03-24
得票数 0
回答已采纳
1
回答
React
Typescript
:使用BrowserRouter的通配符路由
reactjs
、
typescript
、
react-router-v4
import
React
, {useState} from '
react
';import {Layout} from "./routes/not-found';
浏览 24
提问于2019-09-07
得票数 1
回答已采纳
1
回答
使用
typescript
ENUM动态传递道具
javascript
、
reactjs
、
typescript
我开始学习
typescript
,使用
React
,所以在我前进的过程
中
,我试图创造一些场景来练习。Colors { Red= "#FF0000",} //
浏览 18
提问于2019-10-18
得票数 0
回答已采纳
1
回答
如
何在
构造
函数
中
设置
React
组件的属性
reactjs
在我的
React
代码
中
,我想创建一个组件,
如
....return ( )} 在MyChildComponent的构造
函数
中
,如
何在
构造
函数
中
存储对'MyPar
浏览 4
提问于2022-03-12
得票数 0
回答已采纳
1
回答
React
和Flowtype -继承类
javascript
、
reactjs
、
typescript
、
flowtype
让我们假设我type PropsType = { cool: boolean };class Bar extends Foo { this.
props
.cool; //there is no error this.
props
.te
浏览 3
提问于2017-11-23
得票数 2
回答已采纳
1
回答
使用
Typescript
和
React
在专用路由中传递组件属性
reactjs
、
typescript
、
react-router
我正在使用来自
React
Router v4的路由组件的render
props
使用
Typescript
和
React
实现经过身份验证的路由。路由: import
React
from '
react
';import { ROUTES } from{...routeProps} render={(
props</em
浏览 17
提问于2020-08-18
得票数 3
回答已采纳
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
在React中使用TypeScript
我读完了React的API,并为新手送上了一些建议
如何使用GraphQL构建TypeScript+React应用
我用Vue和React构建了相同的应用程序,这是它们的差别
为什么我不再用Vue,改用React?
热门
标签
更多标签
云服务器
ICP备案
实时音视频
即时通信 IM
对象存储
活动推荐
运营活动
广告
关闭
领券