We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import { useRef, useState } from "react"; import { useReactive } from "./useReactive"; const parent = { name: "parent", get value() { return this.name; } }; const child = { name: "child" }; export default function App() { const proxy = useReactive(parent); Object.setPrototypeOf(child, proxy); console.log((child as any).value); // parent return <div className="App"></div>; }
当我访问child.value时我希望的是访问他自身的name属性,而不是原型上的name属性,我查看了一下useReactive源码,有一处地方有个疑问,为什么Reflect.get(target, key)不添加他的第三那个参数,即receiver,去修改this的指向?
codesandbox
The text was updated successfully, but these errors were encountered:
如果走到后面,直接返回 res 就好了哈
Sorry, something went wrong.
代码已经 fix 合并了,下个版本发布就好了
hchlq
Successfully merging a pull request may close this issue.
案例
当我访问child.value时我希望的是访问他自身的name属性,而不是原型上的name属性,我查看了一下useReactive源码,有一处地方有个疑问,为什么Reflect.get(target, key)不添加他的第三那个参数,即receiver,去修改this的指向?

案例地址
codesandbox
The text was updated successfully, but these errors were encountered: