Merge pull request #73 from Dusch4593/master

Modified snippets/Mailto.md
Resolve #66
This commit is contained in:
Angelos Chalaris
2019-09-08 12:41:58 +03:00
committed by GitHub

View File

@ -11,14 +11,14 @@ Renders a link formatted to send an email.
```jsx
function Mailto({ email, subject, body, ...props }) {
return (
<a href={`mailto:${email}?subject=${subject || ''}&body=${body || ''}`}>{props.children}</a>
<a href={`mailto:${email}?subject=${encodeURIComponent(subject) || ''}&body=${encodeURIComponent(body) || ''}`}>{props.children}</a>
);
}
```
```jsx
ReactDOM.render(
<Mailto email="foo@bar.baz" subject="Hello" body="Hello world!">
<Mailto email="foo@bar.baz" subject="Hello & Welcome" body="Hello world!">
Mail me!
</Mailto>,
document.getElementById('root')