@@ -13,7 +13,6 @@ export type State = {
1313
1414export type Props = {
1515 src : string ,
16- type ?: ?string ,
1716 onLoad ?: ?( ) => any ,
1817 onError ?: ?( error : Error ) => any ,
1918 children ?: ?( state : State ) => ?React . Node ,
@@ -74,12 +73,19 @@ export default class ScriptLoader extends React.PureComponent<Props, State> {
7473 }
7574
7675 render ( ) : React . Node {
77- const { children, type, src } = this . props
76+ const {
77+ children,
78+ /* eslint-disable no-unused-vars */
79+ onLoad,
80+ onError,
81+ /* eslint-enable no-unsued-vars */
82+ ...props
83+ } = this . props
7884 return (
7985 < ScriptsRegistryContext . Consumer >
8086 { ( context : ?ScriptsRegistry ) => {
8187 if ( context ) {
82- context . scripts . push ( { type , src } )
88+ context . scripts . push ( props )
8389 if ( ! children ) return < React . Fragment />
8490 const result = children ( {
8591 loading : true ,
@@ -102,15 +108,14 @@ export default class ScriptLoader extends React.PureComponent<Props, State> {
102108
103109export class ScriptsRegistry {
104110 scripts : Array < {
105- type ?: ?string ,
106111 src : string ,
107112 } > = [ ]
108113
109114 scriptTags ( ) : React . Node {
110115 return (
111116 < React . Fragment >
112- { this . scripts . map ( ( { type , src } , index ) => (
113- < script key = { index } type = { type } src = { src } />
117+ { this . scripts . map ( ( props , index ) => (
118+ < script key = { index } { ... props } />
114119 ) ) }
115120 </ React . Fragment >
116121 )
0 commit comments