next-pipe-props
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

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' };
  }
);

Readme

Keywords

none

Package Sidebar

Install

npm i next-pipe-props

Weekly Downloads

0

Version

1.0.9

License

ISC

Unpacked Size

4.9 kB

Total Files

8

Last publish

Collaborators

  • gbibeaulaviolette
  • qjimmy