Custom View Model/Renderer/Strategy


I am porting one older app to ZF3 + ReactJS.

One nice enhancement would be to have a dedicated view Model/Renderer/Strategy, similar with Json. By example by returning a ReactJsModel the view part to take care of anything else needed:

return new ReactJsModel([
‘component’ => ‘MyComponent’,
‘data1’ => 123
‘data2’ => ‘some other value’


Using this the view part should be responsible for creating something as:

ReactDOM.render(React.createElement(MyComponent, {
	data1: 123,
	data2: 'some other value'
}), document.getElementById('app'));

It’s easy to create a View helper to handle this, but because all the views would be looking the same, just a call to the view helper I guess an entire stack of Model/Renderer/Strategy would be useful. As for Json or Feed…

That’s trivial to write, but very specific to your use-case scenario, so probably a bad fit for the framework. There used to be ZendX_Dojo in ZF1: maybe you want to check how we were doing things back then?