diff --git a/README.md b/README.md
index 9a1e261..753df5b 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ Called when the requested script is fully loaded.
URL pointing to the script you want to load.
### `attributes`
-An object used to define custom attributes to be set on the script element. For example, `attributes={{ id: 'someId', 'data-custom: 'value' }}` will result in ``
+An object used to define custom attributes to be set on the script element. For example, `attributes={{ id: 'someId', 'data-custom: 'value' }}` will result in ``. To set `async=false`, specify in `attributes` like so: `attributes={{ async: 'false', ... }}`.
## Example
You can use the following code to load jQuery in your app:
diff --git a/src/index.jsx b/src/index.jsx
index 4fe6756..3b40687 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -89,9 +89,10 @@ export default class Script extends React.Component {
}
script.src = url;
-
- // default async to true if not set with custom attributes
- if (!script.hasAttribute('async')) {
+
+ if (script.hasAttribute('async') && script.getAttribute('async') === 'false') {
+ script.async = false;
+ } else {
script.async = 1;
}
diff --git a/src/index.test.jsx b/src/index.test.jsx
index 6e34ae6..5554bd4 100644
--- a/src/index.test.jsx
+++ b/src/index.test.jsx
@@ -17,7 +17,7 @@ beforeEach(() => {
id: 'dummyId',
dummy: 'non standard',
'data-dummy': 'standard',
- async: false,
+ async: 'false',
},
};
wrapper = shallow();