Skip to content

Commit faacd2d

Browse files
committed
docs: add an example on the readme and intro
1 parent 7928e9e commit faacd2d

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,31 @@ or yarn
2929
yarn add react-scroll-parallax
3030
```
3131

32+
## Example
33+
34+
[Create effects](https://react-scroll-parallax.damnthat.tv/docs/examples/how-it-works) with a hook:
35+
36+
```jsx
37+
function Component() {
38+
const parallax = useParallax({
39+
speed: -10,
40+
});
41+
return <div ref={parallax.ref} />;
42+
}
43+
```
44+
45+
or with a component:
46+
47+
```jsx
48+
function Component() {
49+
return (
50+
<Parallax speed={-10}>
51+
<div />
52+
</Parallax>
53+
);
54+
}
55+
```
56+
3257
## Getting Started
3358

3459
Read the [documentation](https://react-scroll-parallax.damnthat.tv/) for setup and usage instructions.

documentation/docs/intro.mdx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,31 @@ or yarn
3636
yarn add react-scroll-parallax
3737
```
3838

39+
## Example
40+
41+
[Create effects](/docs/examples/how-it-works) with a hook:
42+
43+
```jsx
44+
function Component() {
45+
const parallax = useParallax({
46+
speed: -10,
47+
});
48+
return <div ref={parallax.ref} />;
49+
}
50+
```
51+
52+
or with a component:
53+
54+
```jsx
55+
function Component() {
56+
return (
57+
<Parallax speed={-10}>
58+
<div />
59+
</Parallax>
60+
);
61+
}
62+
```
63+
3964
## Getting Started
4065

4166
- [Usage](/docs/usage/)

0 commit comments

Comments
 (0)