How to pass parameters (data) from plugin PHP to React
WordPress has a function, wp_localize_script() that can do this. You create an array of values that you want to access in your JavaScript file and then inject it as an object. You would modify your enqueue function like this: function include_react_files() { wp_enqueue_style( ‘prefix-style’, plugins_url(‘css/main.ae114d0c.css’, __FILE__) ); // add the JS file to the footer … Read more