Skip to content

Commit 85e8409

Browse files
handymathis@gmail..comhandymathis@gmail..com
authored andcommitted
added usage guide for react
1 parent 639a688 commit 85e8409

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,23 @@ Check out the easy to use documentation and play arround with it.
7575
- <a href="documentation/dropdown.md">Dropdown</a>
7676
- <a href="documentation/scripts.md">Scripts</a>
7777

78+
79+
# Usage with React
80+
81+
First, you need to import the `chocolate.min.css` file into your `index.html` in the `public/` folder.
82+
83+
Now you are able to use the pure css in your React app.
84+
85+
Using scripts is a bit more trickier than the css.
86+
87+
```jsx
88+
componentDidMount() {
89+
const script = document.createElement("script");
90+
script.src = "/sidebar-toggler.js";
91+
document.body.appendChild(script);
92+
}
93+
```
94+
95+
You can use the `componentDidMount` react hook to load the script correctly.
96+
Just implement it into your React component and you are good to go
97+

0 commit comments

Comments
 (0)