腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
这是
什么
React
语法
:
inputRef
?.
current
?.
current
reactjs
我在
React
中看到了这个代码片段。 const selected = document.activeElement ===
inputRef
?.
current
?.
current
;
inputRef
?.
current
?.
current
是否等于if (
inputRef
!== undefined &&
inputRef
.
current
!== undefined) return
inputRef
浏览 99
提问于2020-07-02
得票数 1
回答已采纳
3
回答
何时使用
inputRef
.
current
而不是this.
inputRef
React
.js?
reactjs
、
reference
我对从
react
documentation...All访问引用的两种
语法
感到困惑,我想知道的是
什么
时候在
react
中使用
inputRef
.
current
而不是this.
inputRef
来访问引用
浏览 1
提问于2018-09-01
得票数 4
回答已采纳
2
回答
从父类组件响应类组件的访问属性
javascript
、
reactjs
想象一下以下场景: render() { } const
inputRef
=
React
.useRef(); <Input ref={
inputRef
} />} 我想在我的然而,
inputRef
.
cur
浏览 3
提问于2022-08-11
得票数 1
回答已采纳
2
回答
按住
React
键并单击来自父组件的子组件中的输入
javascript
、
reactjs
import
React
, { createRef } from '
react
';const;const Child = () => { <> <input type="file" ref={
inputRef
浏览 7
提问于2021-03-08
得票数 0
回答已采纳
2
回答
useImperativeHandle如何公开DOM和内部方法?
reactjs
、
react-hooks
但是我也想访问ref.
current
.style --例如,当使用useImperativeHandle时,它目前还没有定义--知道如何通过内部方法传递它吗?() => ({ ... ...ref上面的方法是可行的,但
这是
正确的方法吗(此外,我们还必须做ref.
current
.
current
,这并不是很好)function FancyInput(props,
浏览 3
提问于2020-05-27
得票数 1
回答已采纳
2
回答
如何在Flow中输入useRef钩子?
javascript
、
reactjs
、
flowtype
在TS中,我可以这样做:但这在Flow中不起作用,我不确定用
什么
来代替它。onChange={handleChange} /> </>以下是错误消息: Cannot call
inputRef
浏览 2
提问于2020-12-30
得票数 1
1
回答
对本地钩子做出反应--创建一组参考文献
javascript
、
reactjs
、
react-native
、
react-hooks
此外,在以这种方式创建引用时,我也会遇到一个错误:
React
检测到了按%s调用的钩子顺序的变化。如果不修复,这将导致错误和错误。有
什么
办法吗?谢谢。
浏览 0
提问于2020-09-14
得票数 0
回答已采纳
3
回答
React
不使用样式组件和类型记录
reactjs
、
typescript
、
react-hooks
、
styled-components
对此有
什么
想法吗?旧的答案是指类组件中使用的ref,
这是
在响应钩子之前使用它的唯一方法,在当前版本的样式组件中不再支持 innerRef道具。下面是我的组件的一个示例片段:import styled from 'styled-components'; background: t
浏览 8
提问于2019-09-22
得票数 23
回答已采纳
4
回答
当从输入中获取数字时,
React
计数器不会增加
reactjs
、
react-hooks
、
state
、
counter
、
ref
这是
我的代码:import { useRef } from "
react
"; function handleClick() { setCount(
浏览 4
提问于2022-10-07
得票数 2
回答已采纳
1
回答
反应本机TextInput自聚焦不稳定
react-native
我的TextInput也在Modal里面:问:
这是
一个带有TextInput组件的bug吗?import {TextInput} from "
react
-native"; const
inputRef
= useRefisFocused.
current
&&
in
浏览 1
提问于2022-10-08
得票数 0
1
回答
手动设置为当前时,useRef()钩子使用哪种类型的脚本?
reactjs
、
typescript
、
react-hooks
如何通过Typescript将
React
引用用作可变实例?
current
属性的类型似乎是只读的。我正在使用
React
+ Typescript开发一个库,它可以与
React
未呈现的输入字段进行交互。我想捕获对HTML元素的引用,然后将
React
事件绑定到它。handler on mount/ unmount
inputRef
.
current
= document.getElementById(element
浏览 15
提问于2019-09-20
得票数 95
回答已采纳
4
回答
如何在
react
中动态添加输入字段
reactjs
、
typescript
、
react-functional-component
我使用的是资料UI组件对话框& OutlinedInput const [openSearchId, setOpenSearchId] =
React
.useState<boolean>(false);
inputRef
.
current
?.=
React
.useRef<HTMLInputElement>
浏览 6
提问于2022-06-24
得票数 1
回答已采纳
1
回答
如何离开无限重造?
reactjs
当出现模糊时,我希望执行blurEvent函数,但由于
inputRef
.
current
.blur ();,它将进入无限循环。但我需要离开输入的焦点。如何解决这个问题呢?const
inputRef
=
React
.useRef(null);
inputRef
.
current
.focus({ })
inputRef
.
current<
浏览 5
提问于2021-06-10
得票数 0
2
回答
使用useRef().
current
而不是useRef()有
什么
区别吗?
javascript
、
reactjs
、
react-native
关于使用useRef钩子在
React
中声明引用,我有一个问题。 const
inputRef
= useRef(null).
current
;
这是
: ??例如: a
浏览 1
提问于2020-09-29
得票数 0
回答已采纳
1
回答
如何使用useRef获取中的单击元素
reactjs
这是
怎么回事?
这是
反应中的错误吗?"0px" : `${content.
current
.scrollHeight}px`); console.log(id);
浏览 6
提问于2020-04-07
得票数 0
回答已采纳
2
回答
可以使用useRef钩子空输入值吗?
javascript
、
reactjs
、
react-hook-form
submit按钮时,它工作得很好,但是输入字段仍然有我编写的工作在useRef有
什么
方法可以帮助我清空输入字段吗
这是
密码 const
inputRef
= useRef() e.preventDefault() const todoRef = fire.database()
浏览 2
提问于2020-09-14
得票数 2
回答已采纳
1
回答
React
access组件库的子DOM
javascript
、
reactjs
const MyCustomComponent = (props) => { {
React
.cloneElement当组件是
react
元素时,类型是前向引用。> children: ref: null > type: {$$typeof: Symbol(
react
.forward_refNo reference of DOM
浏览 3
提问于2021-04-16
得票数 0
回答已采纳
1
回答
反应性本机查看器中的自动焦点输入
reactjs
、
react-native
、
android-viewpager
、
react-navigation
、
react-native-elements
请注意,移动到下一页发生在按下按钮,而不是通过正常滚动,
这是
禁用的。 ref.
current
?.:
React
.RefObject<Input> =
React
.createRef(); if (props.pagerFocusIndex === props.index) {
inputRef
.
current
?.不幸的是,
浏览 1
提问于2020-08-27
得票数 0
回答已采纳
2
回答
在
React
js中单击enter键时触发onblur事件
javascript
、
reactjs
、
input
、
focus
我有一个输入文本字段。当用户输入任何文本并单击enter按钮时,我需要激活blur事件来移除焦点并验证文本输入。 <input style={{marginTop:'20%', marginLeft:'40%'}} value={value} type="text" onFocus={onFocus} onChange={e => setValue(e.target.value)} onKeyPress={handleKeyPress}/>
浏览 76
提问于2019-05-20
得票数 7
回答已采纳
1
回答
使用
React
State和UseEffect控制输入字段焦点
javascript
、
reactjs
、
react-hooks
const Focus = () => { const
inputRef
= useRef() if (focused) { } else { }, [focused]) <d
浏览 0
提问于2021-07-02
得票数 1
点击加载更多
相关
资讯
想创建应用程序,只用React Hooks就够了
React实现Form表单
React基础案例05+06 JSX使用外部变量和方法
2024学会使用Vue3封装Hook
通过机器学习识别“迪士尼在逃公主”,程序员宠女的正确打开方式!
热门
标签
更多标签
云服务器
ICP备案
对象存储
实时音视频
云点播
活动推荐
运营活动
广告
关闭
领券