-
Notifications
You must be signed in to change notification settings - Fork 0
Custom Component
safwan39 edited this page Apr 27, 2021
·
5 revisions
to create a custom component you only need to extends Component class
namespace React\Tag;
use React\Component;
class CustomComponent extends Component{
function render(){
return new div('I am custom component');
}
}it is also allowed to have multiple component returned
class CustomComponent extends Component{
function render(){
return [
new div('first component'),
new div('another component'),
];
}
}to render a component
echo new CustomComponent;
echo new CustomComponent([new div('hello')], ['prop1'=> 'prop1_value']); //or with children and props