gpcoders-render-component
v1.0.8
Published
One Paragraph of project description goes here
Downloads
2
Readme
Project Title
One Paragraph of project description goes here
Installing
npm users
npm i gpcoders-render-component
or yarn users
yarn add gpcoders-render-component
Use
Will check the loader state and then it will load the component
import GPRenderComponent from 'gpcoders-render-component'
const DummyData = (props) => {
const { data } = props
}
const App = () => {
return (
<>
<h1>Hello React</h1>
// Spinner bool or data can be in any form
<GPRenderComponent component={DummyData} spinner={true} data={data} />
</>
)
}
With custom loader
Can be used any React component as loader
import GPRenderComponent from 'gpcoders-render-component'
const CustomLoader = () => {
return (
<div>loading...</div>
)
}
const DummyData = (props) => {
const { data } = props
}
const App = () => {
return (
<>
<h1>Hello React</h1>
// Spinner bool or data can be in any form
<GPRenderComponent spinner={true} data={data} customSpinner={<CustomLoader />} />
</>
)
}
GPRenderComponent Props
| Name | Type | Default | Descrption | |:----------:|:-------------:|:----:|:------| | component | Component | ErrorComponent | example: Home, Profile | | spinner | boolean | false | Loader will wait for the component loading | | customSpinner | element | null | Pass custom spinner | | data | any | null | Can be Array, Object etc |