Overview
Treats provides several APIs that exposes its own modules or its wrapped packages.
Filesystem Hooks
Filesystem hooks let you inject codes to Treats internal easily. Filesystem hooks can be defined under src/_**
directories. For example, to inject middleware into Treats redux store:
// src/_redux/middleware.js
import thunk from "redux-thunk";
import { logger } from "redux-logger";
export default [thunk, logger];
See Filesystem Hooks API Reference for more information.
Treats Modules
Treats provides API that exposes its own modules, these modules are usually used to better integrate your codes with Treats internal:
@treats/client
- Expose modules that helps you initialize/do client-side things. See Client API Reference for more information.@treats/server
- Expose modules that help you initialize/do server-side things. See Server API Reference for more information.@treats/component/*
- Expose components that helps integrate your codes better with Treats React internal. See Components for more information.@treats/util/*
- Expose utils that Treats internally uses so you wouldn't need to implement these utilities again. See Utils for more information.
Wrapped Modules
Treats packs and wrap several packages to save you from setting up necessary packages like Redux, Apollo Client, Intl, etc and potential headache when Treats updated its dependencies. There's several packages that could be imported from Treats:
@treats/graphql
- Wrapsreact-apollo
. See GraphQL API Reference for more information.@treats/redux
- Wrapsredux
andreact-redux
. See Redux API Reference for more information.@treats/helmet
- Wrapsreact-helmet
. See Helmer API Reference for more information.@treats/intl
- Wrapsreact-intl
. See Intl API Reference for more information.@treats/locale-data
- Wrapsreact-intl
's locale data. To use these locale-data you could simply import@treats/locale-data/<LANGUAGE_CODE>
.@treats/router
- Wrapsreact-router-dom
. See Router API Reference for more information.