{"id":15984725,"url":"https://github.com/jchavarri/reason-react-lazy-loading","last_synced_at":"2025-03-17T15:32:10.580Z","repository":{"id":39545539,"uuid":"186278679","full_name":"jchavarri/reason-react-lazy-loading","owner":"jchavarri","description":"Example project to show how to use components lazy loading in ReasonReact","archived":false,"fork":false,"pushed_at":"2022-12-10T17:22:33.000Z","size":1657,"stargazers_count":42,"open_issues_count":19,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T01:17:46.771Z","etag":null,"topics":["bucklescript","lazy-loading","react","reason-react","reasonml"],"latest_commit_sha":null,"homepage":"","language":"Reason","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jchavarri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-12T16:32:42.000Z","updated_at":"2024-05-03T16:58:53.000Z","dependencies_parsed_at":"2023-01-26T04:35:14.360Z","dependency_job_id":null,"html_url":"https://github.com/jchavarri/reason-react-lazy-loading","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchavarri%2Freason-react-lazy-loading","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchavarri%2Freason-react-lazy-loading/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchavarri%2Freason-react-lazy-loading/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchavarri%2Freason-react-lazy-loading/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jchavarri","download_url":"https://codeload.github.com/jchavarri/reason-react-lazy-loading/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243869398,"owners_count":20361006,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bucklescript","lazy-loading","react","reason-react","reasonml"],"created_at":"2024-10-08T02:10:17.832Z","updated_at":"2025-03-17T15:32:10.200Z","avatar_url":"https://github.com/jchavarri.png","language":"Reason","funding_links":[],"categories":[],"sub_categories":[],"readme":"# reason-react-lazy-loading\n\nExample project to show how to use components lazy loading in ReasonReact.\n\nReason / BuckleScript adaptation from https://medium.freecodecamp.org/how-to-use-react-lazy-and-suspense-for-components-lazy-loading-8d420ecac58.\n\n## Run Project\n\n```sh\nyarn install\nyarn start\n# in another tab\nyarn run webpack\n```\n\nAfter 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.\n\n**For more elaborate ReasonReact examples**, please see https://github.com/reasonml-community/reason-react-example\n\n## Run Project with Server\n\nTo 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.\n\nNote 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.\n\nTo use a port other than 8000 set the `PORT` environment variable (`PORT=8080 yarn run server`).\n\n## Build for Production\n\n```sh\nyarn run clean\nyarn run build\nyarn run webpack:production\n```\n\nThis 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`).\n\nIf 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).\n\n**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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchavarri%2Freason-react-lazy-loading","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjchavarri%2Freason-react-lazy-loading","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchavarri%2Freason-react-lazy-loading/lists"}