ReasonReact

ReasonReact

  • Docs
  • Try
  • Examples
  • Community
  • Blog
  • Languages iconEnglish
    • 日本語
    • Español
    • Français
    • 한국어
    • Português (Brasil)
    • Русский
    • 中文
    • 繁體中文
    • Help Translate
  • GitHub

›Core

Getting Started

  • What & Why
  • Installation
  • Intro Example

Core

  • Components
  • JSX
  • Event
  • Style
  • Router
  • ReactDOM
  • Refs in React
  • Testing components

Hooks

  • useState
  • useReducer
  • useEffect
  • Custom Hooks

ReactJS Idioms Equivalents

  • Invalid Prop Name
  • Props Spread
  • Component as Prop
  • Ternary Shortcut
  • Context
  • Error boundaries

FAQ

  • I'm Having a Type Error
  • I Really Need Feature X From ReactJS
  • I want to create a DOM element without JSX
Edit

Testing components

Even though types make your code safer, it doesn't remove the need for testing!

If you want to test your ReasonReact components using your JavaScript testing stack, that's perfectly alright, but if you prefer to write them in Reason, here are some testing frameworks and bindings to make your life easier:

Test framework

Pick the test framework you like the best (both use Jest under the hood):

  • reason-test-framework
  • bs-jest

Test utilities

The deprecated ReactDOMTestUtils module has been removed. Use React.act or React.actAsync when testing React updates, melange-testing-library for rendering, querying, and cleaning up components in tests, and melange-webapi for direct DOM access.

See Hooks__test for examples of test setup using testing-library bindings.

← Refs in ReactuseState →