Merge pull request #1 from Dusch4593/Dusch4593-patch-1

Update Mailto.md
This commit is contained in:
Dusch4593
2019-09-07 08:27:50 -04:00
committed by GitHub

View File

@@ -11,14 +11,14 @@ Renders a link formatted to send an email.
```jsx ```jsx
function Mailto({ email, subject, body, ...props }) { function Mailto({ email, subject, body, ...props }) {
return ( 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 ```jsx
ReactDOM.render( 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! Mail me!
</Mailto>, </Mailto>,
document.getElementById('root') document.getElementById('root')