Repository URL to install this package:
|
Version:
3.0.10 ▾
|
import React from 'react'
import { isString } from 'exotic'
import { toType, toSrc } from './deps'
import { SourceProps, SourceType } from './typings'
class Source extends React.PureComponent<SourceProps> {
static from(props: SourceProps | SourceType, index: number) {
const attributes = isString(props) ? { src: props } : props
return <Source key={index} {...attributes} />
}
render() {
const type = toType(this.props)
const src = toSrc(this.props)
return <source src={src} type={type} />
}
}
export { Source }
export default Source