React Nerd Helpers
React Nerd Helpers is a React-based library that provides a set of common UI helpers such as loading and error handling for your applications.
Installation
You can install the React Nerd Helpers library via npm:
npm install @silkyland/react-nerd-helpers
or yarn:
yarn add @silkyland/react-nerd-helpers
Components
The library currently includes the following components:
- NerdLoading: A loading spinner component.
- NerdError: An error display component.
Usage
Below are examples of how to use the NerdLoading
and NerdError
components.
NerdLoading
import { NerdLoading } from '@silkyland/react-nerd-helpers'
function App() {
const [isLoading, setIsLoading] = React.useState(true)
return (
<div>
<NerdLoading visible={isLoading} message="Loading, please wait..." />
{/* Your application code */}
</div>
)
}
NerdError
import { NerdError } from '@silkyland/react-nerd-helpers'
function App() {
const [error, setError] = React.useState(null)
return (
<div>
{error && (
<NerdError
error={error}
onDismissed={() => setError(null)}
title="Oops, something went wrong!"
/>
)}
{/* Your application code */}
</div>
)
}
Contributing
If you have any suggestions or find any bugs, please file an issue on the GitHub page.
License
React Nerd Helpers is released under the MIT License.