docs: add create-react-app svg import usage

close #24175
This commit is contained in:
afc163 2020-05-15 12:37:17 +08:00
parent 610807ebf9
commit 850b670862
2 changed files with 4 additions and 0 deletions

View File

@ -144,6 +144,8 @@ You can import SVG icon as a react component by using `webpack` and [`@svgr/webp
```jsx
import Icon from '@ant-design/icons';
import MessageSvg from 'path/to/message.svg'; // path to your '*.svg' file.
// in create-react-app:
// import { ReactComponent as MessageSvg } from 'path/to/message.svg';
ReactDOM.render(<Icon component={MessageSvg} />, mountNode);
```

View File

@ -139,6 +139,8 @@ ReactDOM.render(<MyIcon type="icon-example" />, mountedNode);
```jsx
import Icon from '@ant-design/icons';
import MessageSvg from 'path/to/message.svg'; // path to your '*.svg' file.
// in create-react-app:
// import { ReactComponent as MessageSvg } from 'path/to/message.svg';
ReactDOM.render(<Icon component={MessageSvg} />, mountNode);
```