# Magewire - Component
## Making components
**My/Module/Magewire/Explanation.php**
```php
getMagewire();
?>
hasFoo()): ?>
= $magewire->getFoo() ?>
```
You will have $magewire at your disposal as long as you're inside a Magewire component. You're able to validate if a public property is set with the ```has``` prefix. Use a ```get``` prefix to get a public property value.
## Layout
The idea behind Magewire is that, like Hyva, it uses the strengths of the Magento layout structure. A block can be converted to a Magewire component in an instant just by assigning a Magewire component class. It's the exact same concept as done with ViewModels.
### Register components
You're not obliged to set a template if the block has a Magewire component. When it's parent block doesn't have a template, Magewire will set the templates based on the component class.
```xml
\My\Module\Magewire\Explanation
```
### Data
Public properties can be set on page load by an optional ```mount()``` method or via the layout XML. When you want to set it via the layout, you have to use a specific structure.
```xml
- \My\Module\Magewire\Explanation
- bar
```
**Note**: The public ```$foo``` property will be set if it exists inside you component.