-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update readme on how to use with react
- Loading branch information
1 parent
56d4086
commit 7ea86c8
Showing
2 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ LetterLoading gives you the possibility to break it and achieve even more simula | |
You can use LetterLoading as a | ||
- script tag from CDN | ||
``` | ||
https://unpkg.com/[email protected].0/library/letterloading.js | ||
https://unpkg.com/[email protected].2/library/letterloading.js | ||
``` | ||
|
||
- install from NPM | ||
|
@@ -49,7 +49,32 @@ var letterload = new LetterLoading('.element', options); | |
|
||
### Use with React js | ||
|
||
Check out a production ready piece @--- to see letterloading live. | ||
```javascript | ||
import React from "react" | ||
// ensure you'd :: npm i letterloading | ||
import LetterLoading from "letterloading"; | ||
|
||
class LetterLoader extends React.Component{ | ||
componentDidMount(){ | ||
const options ={ | ||
strings: ["I love you", "And I meant the former" ] | ||
}; | ||
this.letterload = new LetterLoading(this.el, options); | ||
} | ||
|
||
componentWillUnmount(){ | ||
this.letterload.destroy(); | ||
} | ||
render(){ | ||
return( | ||
<span ref={(el) => { this.el = el; }}/> | ||
) | ||
} | ||
} | ||
|
||
export default LetterLoader; | ||
``` | ||
|
||
|
||
# Contributing | ||
|
||
|
@@ -69,4 +94,4 @@ Read our [contributing guide](/.github/CONTRIBUTING.md) to learn about our devel | |
|
||
# License | ||
|
||
LetterLoading is MIT licensed. | ||
LetterLoading is MIT licensed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters