填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

resolveForwardRef

Lazily retrieves the reference value from a forwardRef.

查看"说明"...

resolveForwardRef<T>(type: T): T
      
      resolveForwardRef<T>(type: T): T
    
参数
type T
返回值

T

参见

说明

Acts as the identity function when given a non-forward-ref value.

使用说明

Example

const ref = forwardRef(() => 'refValue'); expect(resolveForwardRef(ref)).toEqual('refValue'); expect(resolveForwardRef('regularValue')).toEqual('regularValue');
      
      const ref = forwardRef(() => 'refValue');
expect(resolveForwardRef(ref)).toEqual('refValue');
expect(resolveForwardRef('regularValue')).toEqual('regularValue');