All Projects → jchavarri → reason-react-lazy-loading

jchavarri / reason-react-lazy-loading

Licence: MIT license
Example project to show how to use components lazy loading in ReasonReact

Programming Languages

reason
219 projects
javascript
184084 projects - #8 most used programming language
C++
36643 projects - #6 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to reason-react-lazy-loading

Pure
React in pure Reason that targets native platforms.
Stars: ✭ 135 (+229.27%)
Mutual labels:  reasonml, reason-react
Reason Graphql Fullstack
Fullstack Reason + GraphQL Todo List App
Stars: ✭ 246 (+500%)
Mutual labels:  reasonml, reason-react
Fullstack Reason
A demo project that shows a fullstack ReasonML/OCaml app–native binary + webapp
Stars: ✭ 164 (+300%)
Mutual labels:  reasonml, reason-react
Rescript Recoil
Zero-cost bindings to Facebook's Recoil library
Stars: ✭ 115 (+180.49%)
Mutual labels:  reasonml, reason-react
re-use
⚛️ 🎣 A collection of hooks for ReasonReact
Stars: ✭ 27 (-34.15%)
Mutual labels:  reasonml, reason-react
Reroute
a fast, declarative microrouter for reason-react
Stars: ✭ 120 (+192.68%)
Mutual labels:  reasonml, reason-react
Rescript Relay
Use Relay with ReasonML.
Stars: ✭ 214 (+421.95%)
Mutual labels:  reasonml, reason-react
Introduce Reason Example
An example app made with Create React App which introduces a Reason component
Stars: ✭ 82 (+100%)
Mutual labels:  reasonml, reason-react
bs-rsuite-ui-react
Reason bindings for React Suite UI library
Stars: ✭ 26 (-36.59%)
Mutual labels:  reasonml, reason-react
app-template-rescript-react
Adding ReScript with rescript-react on top of @snowpack/app-template-react
Stars: ✭ 44 (+7.32%)
Mutual labels:  reasonml, reason-react
Reason Calculator
A calculator built with Reason and reason-react.
Stars: ✭ 110 (+168.29%)
Mutual labels:  reasonml, reason-react
re-cite
Manage citations from your colleagues , friends, movies, your cat or even yourself.
Stars: ✭ 20 (-51.22%)
Mutual labels:  reasonml, reason-react
Verified React
Automated reasoning for React/ReasonML
Stars: ✭ 104 (+153.66%)
Mutual labels:  reasonml, reason-react
Brisk Reconciler
React.js-like reconciler implemented in OCaml/Reason
Stars: ✭ 124 (+202.44%)
Mutual labels:  reasonml, reason-react
Timerlab
⏰ A simple and customizable timer
Stars: ✭ 84 (+104.88%)
Mutual labels:  reasonml, reason-react
Bs Material Ui
ReScript bindings for material-ui
Stars: ✭ 185 (+351.22%)
Mutual labels:  reasonml, reason-react
Recontainers
[DEPRECATED] ReasonReact utilitary high order components
Stars: ✭ 54 (+31.71%)
Mutual labels:  reasonml, reason-react
Rescript React Update
useReducer with updates and side effects!
Stars: ✭ 79 (+92.68%)
Mutual labels:  reasonml, reason-react
bs-dynamic-import
📦🚀 BuckleScript dynamic import interop on JavaScript environment
Stars: ✭ 31 (-24.39%)
Mutual labels:  lazy-loading, reasonml
re-typescript
An opinionated attempt at finally solving typescript interop for ReasonML / OCaml.
Stars: ✭ 68 (+65.85%)
Mutual labels:  reasonml, reason-react

reason-react-lazy-loading

Example project to show how to use components lazy loading in ReasonReact.

Reason / BuckleScript adaptation from https://medium.freecodecamp.org/how-to-use-react-lazy-and-suspense-for-components-lazy-loading-8d420ecac58.

Run Project

yarn install
yarn start
# in another tab
yarn run webpack

After you see the webpack compilation succeed (the yarn run webpack step), open up build/index.html (no server needed!). Then modify whichever .re file in src and refresh the page to see the changes.

For more elaborate ReasonReact examples, please see https://github.com/reasonml-community/reason-react-example

Run Project with Server

To run with the webpack development server run yarn run server and view in the browser at http://localhost:8000. Running in this environment provides hot reloading and support for routing; just edit and save the file and the browser will automatically refresh.

Note that any hot reload on a route will fall back to the root (/), so ReasonReact.Router.dangerouslyGetInitialUrl will likely be needed alongside the ReasonReact.Router.watchUrl logic to handle routing correctly on hot reload refreshes or simply opening the app at a URL that is not the root.

To use a port other than 8000 set the PORT environment variable (PORT=8080 yarn run server).

Build for Production

yarn run clean
yarn run build
yarn run webpack:production

This will replace the development artifact build/Index.js for an optimized version as well as copy src/index.html into build/. You can then deploy the contents of the build directory (index.html and Index.js).

If you make use of routing (via ReasonReact.Router or similar logic) ensure that server-side routing handles your routes or that 404's are directed back to index.html (which is how the dev server is set up).

To enable dead code elimination, change bsconfig.json's package-specs module from "commonjs" to "es6". Then re-run the above 2 commands. This will allow Webpack to remove unused code.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].