PHP code example of sasab / react-bridge

1. Go to this page and download the library: Download sasab/react-bridge library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sasab / react-bridge example snippets



    // Data provided from the server that will be passed as props to your component
    $props = ['foo' => 'bar'];

    // Default options
    <?= react_component('my-component', $props, [
        'ref' => false,
        'component' => null,
        'path' => '/resources/assets/js',
        'folder' => 'components',
        'filename' => 'react'    
    ]) 

    react_component('my-component', $data, ['component' => 'Articles/Comments/SingleComment']);
    

    react_component('my-component', $data, ['component' => 'Articles.Comments.SingleComment']);
    

        react_component(['my-component', 'Articles.Comments.SingleComment'], $data);