/15-tips-for-reason-and-reasonreact

📝 Notes and code snippets for basic recipes in ReasonML

Primary LanguageOCaml

15 Tips for Learning Reason & ReasonReact

  1. Filename determines module name.
  2. You don't need to import modules!
  3. Converting between different Reason data types.
  4. Don't forget to convert basic data types to React elements, with ReasonReact.string, ReasonReact.array, or ReasonReact.null.
  5. Passing props, and the use of ~ and _ with argument names
  6. Learn to define variants and records.
  7. Pattern matching!
  8. Handle state in ReasonReact with a reducerComponent.
  9. Higher order functions in Reason.
  10. Style with CSS stylesheet or inline.
  11. Bucklescript's Belt module provides us a more Javascript-like standard library.
  12. Functions in Reason are automatically curried.
  13. The pipe |> and fast pipe -> operators enables function chaining
  14. Fetching and handling JSON - ReasonReact meets world
  15. Router comes included!
  16. Search for Reason bindings to use popular npm libraries

How to run the Routing app

  1. cd reasonreact-routing-tip
  2. npx http-server
  3. Open up the given ip address
  • We need to have a valid url for Reason to create a history state object