Second
Second is a framework for building and rendering React components on the server. It provides a higher-order data component that enables UI components to declare their data dependencies. Second ensures that all data dependencies are met before completing a render cycle. Components that require interactivity in the browser can be dehydrated with their original props, and rehydrated in the browser.
This package is a convenience wrapper interface around the following Second components:
Installation
npm install --save second
Usage
second const MyDataComponent = second second
Or with Preact
second
Dehydrate components to prepare them for rehydration on the client:
// sub-component.jsconst React = const second = Component { // ... } moduleexports = second // main-component.jsconst React = const SubComponent = moduleexports = Component { return <div> <SubComponent ="foo" ="bar"> <span>Children will be dehydrated as well!</span> </SubComponent> </div> }