Overview
The ReScript React Starter Kit is an opinionated starter kit for developing applications using ReScript and React. It provides a familiar standard library, ready-to-go request handling, a development server, a testing library, styling with Emotion, routing capabilities, and the ability to manage titles and metadata. The kit also includes a set of commands for starting the compiler, development server, building the project, bundling, and running the test suite.
Features
- Familiar standard library: The kit provides a configuration that automatically includes the Belt and ReScriptJs.Js libraries, allowing for easy manipulation of ReScript-specific types while defaulting to JavaScript APIs when available.
- Ready-to-go requests: Three building blocks, including AsyncData, Future, and Request, are provided to handle API calls easily and manage asynchronous data in React component state.
- Dev server: The development server waits for the BuckleScript compiler to be ready before triggering a compilation, reducing waiting times during project development.
- Testing library: ReScriptTest is included, providing a light testing framework that integrates well with React and allows for mocking HTTP call responses. The library takes care of running and rendering the tests, while the assertion part is left to the user.
- Styling with Emotion: The kit includes zero-cost bindings to Emotion, allowing for CSS-in-ReScript styling right out of the box.
- Routing: A routing system is provided, with the ability to manage routes using the Router and <Link /> modules. By setting the PUBLIC_PATH environment variable, the boilerplate takes care of the rest.
- Titles & metadata: The kit provides a way to set titles and metadata for each route using the <Head /> component, which binds to react-helmet.
Installation
To install the ReScript React Starter Kit, follow these steps:
- Clone the repository:
git clone [repository_url]
- Change to the project directory:
cd [project_directory]
- Install dependencies:
yarn install
To use the kit, run the following commands:
yarn start
: Starts the ReScript compiler in watch mode.yarn server
: Starts the development server.yarn build
: Builds the project.yarn bundle
: Bundles the project.yarn test
: Runs the test suite.
Summary
The ReScript React Starter Kit is a comprehensive starting point for developing applications using ReScript and React. It provides essential features such as a familiar standard library, request handling, a development server, a testing library, styling with Emotion, routing capabilities, and the ability to manage titles and metadata. The kit is easy to install and comes with a set of commands for seamless development, building, bundling, and testing.