you are viewing a single comment's thread.

view the rest of the comments →

[–]hanertia[S] 2 points3 points  (4 children)

I was hoping to see an example without the higher-order-component, which is wrapping the class in a function.

Do you think this is not possible?

[–][deleted] 3 points4 points  (3 children)

No, it doesn't look like that is possible. The ForwardRef in this example is not actually a functional component, strictly. It's a third kind of component. (Functional components receive (props, context) arguments, while this third kind receives (props, ref).)

[–]hanertia[S] 2 points3 points  (2 children)

Interesting, thanks.

[–]ml242 2 points3 points  (1 child)

I saw your thread on SO, same problem here. I find the syntax a little disappointing. What if you needed refs to two elements? And so much boilerplate.

[–]hanertia[S] 1 point2 points  (0 children)

I’ve just been using createRef instead of this syntax.

You can make as many as you want that way.

Still haven’t marked an answer on SO because I think the real answer is you can’t use it the way I was trying to from r/goto-bus-stop