Open koenverburg opened 7 years ago
Can you give an update on this?
Yes there is a blade directive called hypernova that you can use like in your example:
@hypernova( 'MyComponent.js', [
'name' => 'Person', 'props' => 'value'
])
Directive only works when Middleware is activated:
// app/Http/Kernel.php
protected $middleware = [
...
\Folklore\Hypernova\HypernovaMiddleware::class,
];
@dmongeau correct me if I'm wrong: Directive only outputs placeholders. They are replaced in Middleware by corresponding Hypernova job result (HTML string).
Please note that there seems to be a bug in the Middleware.
Finally, the following blog post helped me to get started: https://blog.larah.me/2017/04/10/react-server-side-rendering/
Yes you are right, you need the middleware, because by outputting only a placeholder, if the rendering server doesn't work, the client code render the UI instead. But I really have a job to make this package "more public" with doc didn't expect, it will be used in this state. But I'm open to any PR improving it
@dmongeau Does each call to @hypernova directive addJob to the batch? And all components are then sent to the server at once?
I can answer my question now and yes it does!
Can you make an example. The Hypernova-ruby uses this in there templating engine.
Can we write something like this to render a component which is wrapped with hypernova-react?