与“反应”一起使用
查看实际示例
FF0000
Add
Sampel Code for React
import { IconMasterReact, IconMasterType } from 'icon-master'
const [color, setColor] = useState('FF0000')
const [iconName, setIconName] = useState<IconMasterType>('Add')
export default () => {
return (
<div>
<IconMaster color={color} name={iconName} />
</div>
)
}
import { useState } from 'react'
export default () => {
const [color, setColor] = useState('FF0000')
const [iconName, setIconName] = useState('Add')
return (
<div>
...
<img srcSet={`https://icon-master.com/i/${iconName}/${color}`} />
// or
<img srcSet={`https://icon-master.com/i/Bell/${color}`} />
// or
<img srcSet={`https://icon-master.com/i/${iconName}/FF0000`} />
...
</div>
)
}