getters
Introduction

@nimpl/getters

(Former next-impl-getters)

Implementation of server getters in React Server Components without switching to SSR.

Before using the library, read the Possible Issues

Installation

Using npm:

npm i @nimpl/getters

Current Getters

Stability

All getters are covered with tests. Tests are run on every release and every 6 hours on the latest Canary version of Next.js.

In this way, you can be sure not only of the stability of the code, but also that if there is a breaking change in Next.js, this will immediately become known. Even before the release of a stable version of Next.js.

Examples

You can see examples in the package repository.

What’s next?

Why getters instead of extending existing hooks?

I’m not very fond of the idea of extending hooks - on the server, it won’t be a hook no matter how you look at it. These are specifically getters. Moreover, a client-side hook can be synchronous, while a server-side getter for the same task can be asynchronous, making it a more versatile format.

Additional

This package came as an attempt to implement a working get-pathname solution while waiting for a PR merge to add get-pathname to next.js. However, it proved to be an independent solution.

Please consider giving a star if you like it, it shows that the package is useful and helps continue work on this and other packages.

Create tasks with wishes, ideas, difficulties, etc. All of them will definitely be considered and thought over.