Treats

Treats

  • Getting Started

›API Reference

Getting Started

  • Installation

Tutorial

  • 01. Creating Your First Page
  • 02. Using Redux
  • 03. Using GraphQL
  • 04. Fetch Data for SSR
  • 05. Adding Addons

Main Concepts

  • Overview
  • Routing
  • Localization
  • Code-splitting
  • Redux
  • GraphQL Client
  • Middlewares
  • Helpers
  • Server-side Events
  • Server-side Template
  • Server-side Rendering
  • Custom Server App
  • Custom Client Initialization
  • Custom React App
  • Runtime Config
  • Build Config
  • Environment Variables
  • Code Generator
  • Scripts
  • Addons
  • Typescript
  • Workbox

API Reference

  • Overview
  • Filesystem Hooks
  • Components
  • Server
  • Client
  • Router
  • Intl
  • Locale Data
  • Helmet
  • Redux
  • Graphql

Authoring Addons

  • Overview
  • Helpers
  • Middlewares
  • Generators
  • Wrapping Up

Addons

  • Treats Addons List

Contributing

  • How To Contribute

FAQ

  • FAQs

Client

Treats also exposes initClient wrapper function to customize client app.

InitClient

A simple wrapper function that can be used as a helper to customize your client instance, this wrapper function can be imported from @treats/client.

// src/_client/index.js
import initClient from "@treats/client";

const app = initClient();

export default app;

Parameter

  • config object Client configuration object
  • config.reduxState Redux State Redux state that would be used to rehydrate client's Redux store.
  • config.apolloState Apollo State Apollo State that would be used to rehydrate Apollo in-memory cache on the client-side.
  • config.lang string Current language of the app.
  • config.rootDiv string The ID of the root div where your React app should be injected.
  • config.appProps object Other props that you'll want to pass to your React app.
← ServerRouter →
Tokopedia Open Source
Copyright © 2019 Tokopedia OSS