Update Callto.md

This commit is contained in:
Angelos Chalaris
2020-11-27 09:45:40 +02:00
committed by GitHub
parent a2eaa2fbe5
commit 9613280f22

View File

@ -3,24 +3,20 @@ title: Callto
tags: components,beginner
---
Renders a link formatted to dial a phone number.
Renders a link formatted to call a phone number (`tel:` link).
- Destructure the component's props, use `phone` to create a `<a>` element with an appropriate `href` attribute.
- Use `phone` to create a `<a>` element with an appropriate `href` attribute.
- Render the link with `children` as its content.
```jsx
const Callto = ({ phone, children }) => {
return (
<a href={`tel:${phone}`}>{children}</a>
);
return <a href={`tel:${phone}`}>{children}</a>;
};
```
```jsx
ReactDOM.render(
<Callto phone="+923081734339">
Call me!
</Callto>,
<Callto phone="+302101234567">Call me!</Callto>,
document.getElementById('root')
);
```