@bentoo/react-lazy 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +27 -22
- package/package.json +6 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Manuel Bento
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
|
|
2
2
|
# @bentoo/react-lazy
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
A library designed to make it easier to implement `Lazy Loading` in `React` applications. It allows components to load only when they become visible on the screen, providing a way to monitor the entry of elements into the viewport.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
With this tool, you can improve the performance of your application by reducing the initial loading time and ensuring that `only the necessary elements are loaded`. This approach contributes to a more agile and responsive user experience.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
You can install the package via NPM:
|
|
9
11
|
|
|
10
12
|
```bash
|
|
11
13
|
npm install @bentoo/react-lazy
|
|
12
14
|
```
|
|
13
|
-
|
|
15
|
+
|
|
16
|
+
or via Yarn:
|
|
14
17
|
|
|
15
18
|
```bash
|
|
16
19
|
yarn add @bentoo/react-lazy
|
|
17
20
|
```
|
|
18
|
-
|
|
21
|
+
|
|
22
|
+
or via pnpm:
|
|
23
|
+
|
|
19
24
|
```bash
|
|
20
25
|
pnpm add @bentoo/react-lazy
|
|
21
26
|
```
|
|
22
27
|
|
|
23
|
-
##
|
|
28
|
+
## Usage
|
|
24
29
|
|
|
25
|
-
|
|
30
|
+
Here’s a basic example of how to use `@bentoo/react-lazy` in your project:
|
|
26
31
|
|
|
27
32
|
```tsx
|
|
28
33
|
import React from 'react';
|
|
@@ -42,25 +47,25 @@ const App = () => {
|
|
|
42
47
|
export default App;
|
|
43
48
|
```
|
|
44
49
|
|
|
45
|
-
###
|
|
50
|
+
### Props
|
|
46
51
|
|
|
47
|
-
`LazyComponent`
|
|
52
|
+
`LazyComponent` accepts the following props:
|
|
48
53
|
|
|
49
|
-
|
|
|
50
|
-
|
|
51
|
-
| `fallback`
|
|
52
|
-
|children
|
|
54
|
+
| Prop | Type | Description |
|
|
55
|
+
|-------------|-------------|-------------------------------------------------------------------|
|
|
56
|
+
| `fallback` | `ReactNode` | The content to display while the component is being loaded. |
|
|
57
|
+
| `children` | `ReactNode` | The content that will be displayed after loading. |
|
|
53
58
|
|
|
54
|
-
##
|
|
59
|
+
## Contribution
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
If you would like to contribute, feel free to open a pull request or report an issue.
|
|
57
62
|
|
|
58
|
-
1.
|
|
59
|
-
2.
|
|
60
|
-
3. Commit
|
|
61
|
-
4.
|
|
62
|
-
5.
|
|
63
|
+
1. Fork the project.
|
|
64
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
|
65
|
+
3. Commit your changes (`git commit -m 'Adding new feature'`).
|
|
66
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
|
67
|
+
5. Open a Pull Request.
|
|
63
68
|
|
|
64
|
-
##
|
|
69
|
+
## License
|
|
65
70
|
|
|
66
|
-
|
|
71
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"email": "manuelbentomb.223@hotmail.com"
|
|
6
6
|
},
|
|
7
7
|
"private": false,
|
|
8
|
-
"version": "0.2.
|
|
8
|
+
"version": "0.2.2",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"module": "./dist/index.js",
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
@@ -45,5 +45,9 @@
|
|
|
45
45
|
"typescript": "^5.5.3",
|
|
46
46
|
"typescript-eslint": "^8.0.1",
|
|
47
47
|
"vite": "^5.4.1"
|
|
48
|
-
}
|
|
48
|
+
},
|
|
49
|
+
"keywords": [
|
|
50
|
+
"react","nextjs",
|
|
51
|
+
"lazy-loading","react-lazy","react-lazy-load"
|
|
52
|
+
]
|
|
49
53
|
}
|