1.0.9 • Published 3 years ago

next-pipe-props v1.0.9

Weekly downloads
330
License
ISC
Repository
-
Last release
3 years ago

Next pipe props

NPM Next-pipe-props is a zero dependency package meant to give a pipe helper when getting ssr or static props to a Next.js page.

Installation

Simply install with yarn

yarn add next-pipe-props

or npm

npm install next-pipe-props --save

Usage:

next-pipe-props lets you pipe different functions (async works as well) in order to construct your final prop object. The data is piped from the first function and passed down as the argument to the next function. The best developer experience comes from passing full objects and returning your final prop object. the

import { pipeProps } from 'next-pipe-props';

function About({ helloWorld }) {
  return <div>{helloWorld}</div>;
}

export default About;

export const getStaticProps = pipeProps(
  async () => {
    return { initialData: 'hello' };
  },
  ({ initialData }) => {
    return { helloWorld: initialData + ' world' };
  }
);
1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago