Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@enrise/usepromiseloader
Advanced tools
A react hook for nextjs that enables you to show a loader when data is fetched with getInitialProps in SPA mode
In NextJs a page will only be rendered when everything in getInitialProps
is loaded.
This hook will allow you to directly render and show a loader while the data is being loaded. Once the data is loaded the page will re-render and show the data.
npm install @enrise/usepromiseloader
import usePromiseLoader from '@enrise/usepromiseloader'
type TestPageProps = {
data: string
};
const TestPage: NextPage<TestPageProps> = ({ data }) => {
const [resolvedData, loading] = usePromiseLoader(data, '');
return (
<div>
{loading && 'loading...'}
{!loading && resolvedData}
</div>
)
}
TestPage.getInitialProps = async () => {
const data = process.browser ? getData() : await getData();
return { data };
}
As you can see in the getInitialProps
the promise from getData
is directly returned when it is ran in a browser. The usePromiseLoader
hook will make sure that the data is correctly loaded when the promise is resolved.
FAQs
A react hook for nextjs that enables you to show a loader when data is fetched with getInitialProps in SPA mode
The npm package @enrise/usepromiseloader receives a total of 2 weekly downloads. As such, @enrise/usepromiseloader popularity was classified as not popular.
We found that @enrise/usepromiseloader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.