"React"で使用する

サンプルの動作を確認する

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>
    )
}