Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
next-redux-store
Advanced tools
Next integration with Redux.
Features:
npm i next-redux-store
import { AppProps } from 'next/app';
import { StoreProvider } from 'next-redux-store';
import { makeStore } from 'modules/makeStore';
// Note that makeStore must accept preloadedState as an argument
// See example (https://github.com/fakundo/next-redux-store/blob/master/packages/docs/modules/makeStore.tsx#L4)
export default function _App(appProps: AppProps<any>) {
const { Component, pageProps } = appProps;
return (
<StoreProvider makeStore={makeStore} appProps={appProps}>
<Component {...pageProps} />
</StoreProvider>
);
}
import { makeStore } from 'modules/makeStore';
import { createGetInitialProps } from 'next-redux-store/server';
const getInitialState = async (ctx, appProps) => {
const store = makeStore();
// Fill the store considering the App props and Document context
// See example (https://github.com/fakundo/next-redux-store/blob/master/packages/docs/pages/_document.tsx#L14)
return store.getState();
}
export default class _Document extends Document {
static getInitialProps = createGetInitialProps(getInitialState);
render() {
...
}
}
import { serverSideState } from 'next-redux-store/server';
export const getStaticProps = async () => {
const store = makeStore();
// Fill the store
const initialState = store.getState();
return {
props: {
...serverSideState(initialState),
},
};
}
import { ProviderProps } from 'react-redux';
interface StoreProviderProps extends Omit<ProviderProps, 'store'> {
appProps: AppProps<any>;
makeStore: (preloadedState: any | undefined) => any;;
}
createGetInitialProps creates a function that returns initial props for the Document, providing initialState of store for the App.
type CreateInitialState = (ctx: DocumentContext, appProps: AppProps<any> | undefined) => any;
const createGetInitialProps: (createInitialState: CreateInitialState) => (ctx: DocumentContext) => DocumentInitialProps;
createInitialState can accept two parameters: App props and Document context.
serverSideState accepts state of the store and returns page props.
HYDRATE returns name of the hydration action.
MIT
FAQs
Next integration with Redux
The npm package next-redux-store receives a total of 0 weekly downloads. As such, next-redux-store popularity was classified as not popular.
We found that next-redux-store 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.