I have a site already developed in Laravel 5.5 and trying to implement React preset in it, but I want to send the variables I use in Blade to the React components to do the rendering.
I installed laracasts/utilities and followed the instructions here https://github.com/laracasts/PHP-Vars-To-Js-Transformer changing the namespace to reactBinding but it isn't working as expected.
On Laravel I do:
JavaScript::put([
'foo' => 'bar',
'age' => 29
]);
When running console.log(window) I can see it has the spacename I created with the corresponding values, but console.log(window.reactBinding) and console.log(reactBinding) are both undefined.
Any idea what I could be missing? Is there any extra step to make it work in React? Is there a better way to send variables from Laravel controllers to React components?