Skip to content

Commit beaa385

Browse files
committed
[bump] v0.4.0
- fixed issue with refs
1 parent 33d75fa commit beaa385

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎HISTORY.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# History
22

3-
## 0.3.3
3+
## 0.4.0
44

5+
- Fixed issue with refs
56
- Bump all deps
67

78
## 0.3.2

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-async-script",
3-
"version": "0.3.2",
3+
"version": "0.3.3",
44
"description": "A composition mixin for loading scripts asynchronously for React",
55
"main": "lib/async-script-loader.js",
66
"scripts": {

‎src/async-script-loader.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default function makeAsyncScript(Component, scriptURL, options) {
3939
},
4040

4141
getComponent() {
42-
return this.refs.childComponent;
42+
return this.childComponent;
4343
},
4444

4545
componentDidMount() {
@@ -141,16 +141,16 @@ export default function makeAsyncScript(Component, scriptURL, options) {
141141
if (globalName && typeof window !== "undefined") {
142142
childProps[globalName] = typeof window[globalName] !== "undefined" ? window[globalName] : undefined;
143143
}
144-
return <Component ref="childComponent" {...childProps} />;
144+
return <Component ref={(comp) => {this.childComponent = comp; }} {...childProps} />;
145145
},
146146

147147
};
148148

149149
if (options.exposeFuncs) {
150150
for (let funcToExpose of options.exposeFuncs) {
151151
/* eslint-disable no-loop-func */
152-
funcs[funcToExpose] = function () {
153-
return this.refs.childComponent[funcToExpose](...arguments);
152+
funcs[funcToExpose] = function() {
153+
return this.childComponent[funcToExpose](...arguments);
154154
};
155155
/* eslint-enable no-loop-func */
156156
}

0 commit comments

Comments
 (0)