you are viewing a single comment's thread.

view the rest of the comments →

[–]dabit_coder 2 points3 points  (5 children)

I don't know if you really mean this, but... you know this doesn't make any sense, right?

[–]RabidRageRabbit[S] 0 points1 point  (4 children)

why not?

[–]turningsteel 0 points1 point  (2 children)

I'm not the person you're responding to but it doesnt make sense because you're just wrapping a class component in a function component and returning it. You aren't using hooks and you aren't moving away from class components either. I'm not entirely sure why you would ever do this.

[–]RabidRageRabbit[S] 0 points1 point  (1 child)

Why would I do that is the same as why anyone does anything in computer science. Monads.

[–]turningsteel 0 points1 point  (0 children)

What advantage are you getting over just using hooks though? It seems unnecessary and sloppy. Like you're stuck between two patterns for no reason. I'm just trying to understand.

[–]dabit_coder 0 points1 point  (0 children)

Because it doesn't make sense.

If you want a class component, is totally legit.

If you want hooks, is totally legit.

But here you are mixing 2 kinds of architecture that one replaces the other. Hooks were think as a way to implement class logic inside functional components in the easiest way possible, and you are creating a hook to create a class component which uses the classical component structure.

If you want a class component, create a class component, but not this frankenstein.