1.0.3 • Published 10 months ago
raphealdev-library v1.0.3
Get started
raphealdev library is a custome library for react components
Installation
Run npm i raphealdev-library
Useage:
import { DateFormatter, Libography } from "raphealdev-library"
function App(){
const date={
createdAt: "2023-06-26T00:15:07.884Z"
}
return (
<div>
<Libography text={Time formatter} fontPoppins fontSemibold />
<DateFormatter item={date} />
</div>
)
}
Parameters
The DateFormatter accepts one parameters which is destrictured as props item
the incoming parameter or props must have createdAt
inside it object
The Libography accepts four props each has thier functions eg
: text
the text props is required to dispaly the text on ui
while isLoaidng
a built in loading state which accepts a functional loading state as props can be used : while :awating api response
how to use
How to use Libography loading state:
import React, {useState} from 'react'
import { Libography } from "raphealdev-library"
function App(){
const [isLoading, setIsLoading]=useState(false)
useEffect(() =>{
setIsLoading(true)
try{
const getRes = async()=>{
await axios.get(`${BASE_URL}/res`)
}catch(){
console.log(error)
}finally{
setIsLoading(false)
}
}
getRes()
},[])
return (
<div>
<Libography text="the response was ok" fontPoppins fontSemibold isLoading={isLoading} />
</div>
)
}