-
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 dev('I am custom component');
}
}it is also allowed to have multiple component returned
class CustomComponent extends Component{
function render(){
return [
new dev('first component'),
new dev('another component'),
];
}
}to render a component
echo new CustomComponent;
echo new CustomComponent([new dev('hello')], ['prop1'=> 'prop1_value']); //or with children and props