This page guide you completely how to install & configure react-pings into your project or even in exinsting project.
Vite
Vite is a popular frontend build tool for that aims to provide a faster and leaner development experience for modern web projects. To get react-pings into new project follow the steps:
Create App
Create your project through npm or any other CLI tools
Terminal
npm create vite@latest my-app
npm create vite@latest my-app
This will ask you some prompts, select React, javascript/typescipt after this you have new folder my-app.
Now you have a vite app & completely able to install react-pings into your project. Just run the command into your termnal.
Terminal
cd my-app npm install react-pings npm run dev
cd my-app npm install react-pings npm run dev
This command install react-pings library into your project and start development server.
Usage
If you are in this section that means your project alredy have react-pings installed. Its time to use it according to your need.
Typescript
1// main.tsx/ts/jsx/js
2
3import { PingsToastsProvider } from "react-pings";
4import "../node_modules/react-pings/dist/index.css"; // import css if needs
Make sure you wrap your <App /> is just one level in depth. Otherwise it will make problems with your other providers.
After following this step your app have usePings hook globally, just import it into any compenent and your compenent is now ready to produce toasts. Check the below code for example.
Make sure you wrap your {children} is just one level in depth. Otherwise it will make problems with your other providers.
After following this step your app have usePings hook globally, just import it into any compenent and your compenent is now ready to produce toasts. Check the below code for example.