author import React from 'react' ; import style from './style.less' ; const importAll = ( requireContext ) => requireContext . keys ( ) . forEach ( requireContext ) ; try { importAll ( require . context ( '../../assets/iconsvg' , false , /\.svg$/ ) ) ; } catch ( error ) { console . log ( error ) ; } export interface IconSvgProps { type : string ; style ? : React . CSSProperties ; className ? : string ; } const IconSvg = props => { const { type , className , ... attr } = props ; return ( < svg className = { `${ style [ 'icon-svg' ] } ${ className || '' }` } { ... attr } > < use xlinkHref = { `#${ type }` } /> < /svg>); } ; export default IconSvg ;