DEV Community

呵呵
呵呵

Posted on

what't the recommand way to pass a object instance down to child component

like create some expensive object at initial render, because the arguements needs to be decided from the url or props:
`
const ref = useRef();

if (!ref.current) {
ref.current = new SomeExpensiveInitialClass(props.xxx);
}
`
i want to pass the ref down deeply to child component

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay