ViewModel for React Alpha

Can you use recompose or higher order components with this?

The short answer is that a VM component is a managed React component. You can wrap it however you want and the inner component will continue to behave the way it was designed.

For a long answer I need more info. Can you give an example of something you want to do? I ask because I’ve never heard of anyone wanting, much less needing, higher order components with VM.

2 Likes

It’s only a compliance with convention concern.

Would be cool if you could convert react to viewmodel and back as source code goes.

That’s not possible in any satisfactory way. It’s like compiling another language to JavaScript. Yeah, the end result executes, but it’s far from what you’d write by hand.

I imagine there’re some prettify layers through which them innards could be churned through, CS is somewhat pallatable.

The problem is intent. CS motto is “it’s just Javascript”. Now imagine transpiling CS if it didn’t allow for map or reduce. You could definitely transpile it but you wouldn’t end up with idiomatic Javascript.