Skip to content

Commit

Permalink
update readme on how to use with react
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinsekx committed Oct 30, 2020
1 parent 56d4086 commit 7ea86c8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "letterloading",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "https://github.com/kelvinsekx/letterloading#readme",
"repository": {
"type": "git",
Expand Down

0 comments on commit 7ea86c8

Please sign in to comment.