{"id":18416730,"url":"https://github.com/gcbenlloch/react-router-with-props","last_synced_at":"2025-04-07T12:32:04.979Z","repository":{"id":57343903,"uuid":"105558532","full_name":"GCBenlloch/react-router-with-props","owner":"GCBenlloch","description":"Custom routes for react router dom","archived":false,"fork":false,"pushed_at":"2018-06-27T08:51:05.000Z","size":37,"stargazers_count":24,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-15T04:33:17.438Z","etag":null,"topics":["react","react-router-dom","react-router-v4"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-router-with-props","language":"JavaScript","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/GCBenlloch.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":"2017-10-02T16:38:44.000Z","updated_at":"2024-02-14T17:00:32.000Z","dependencies_parsed_at":"2022-09-12T06:51:06.809Z","dependency_job_id":null,"html_url":"https://github.com/GCBenlloch/react-router-with-props","commit_stats":null,"previous_names":["gonzalocbenlloch/react-router-with-props"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GCBenlloch%2Freact-router-with-props","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GCBenlloch%2Freact-router-with-props/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GCBenlloch%2Freact-router-with-props/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GCBenlloch%2Freact-router-with-props/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GCBenlloch","download_url":"https://codeload.github.com/GCBenlloch/react-router-with-props/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247653154,"owners_count":20973773,"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":["react","react-router-dom","react-router-v4"],"created_at":"2024-11-06T04:06:59.659Z","updated_at":"2025-04-07T12:32:01.046Z","avatar_url":"https://github.com/GCBenlloch.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-router-with-props\n\nExtra routes for [react-router-dom](https://github.com/ReactTraining/react-router).\n\n### Install\n\nInstall it\n```\nnpm i -S react-router-with-props\n```\n\nand import it in your file\n```\nimport { PropsRoute, PublicRoute, PrivateRoute } from 'react-router-with-props';\n```\n\n### Route types\n* *PropsRoute* - Default route to which you can pass props.\n* *PublicRoute* - It prevents the access to auth users and you can pass props to it.\n* *PrivateRoute* - It prevents the access to unauth users and you can pass props to it.\n\n### Props Route\nIt's the [basic route](https://reacttraining.com/react-router/web/example/basic), but you can pass props to it like to any other component.\n**Any one can access it.**\n```js\n\u003cPropsRoute exact path=\"/\" component={Title} text=\"Hello world!\" /\u003e\n```\n\n### Public Route\n\nIt requires two extra props.\n| Prop | Type |  |\n|---|---|---|\n| authed | boolean | If the user is authed or not |\n| redirectTo | string | route to redirect if necessary |\n\n**Only unauthed users can access it.**\n\nThe next exemple will call the Title component and will pass to it the text prop.\n```js\n\u003cPublicRoute exact path=\"/public\" authed={false} redirectTo=\"/admin\" component={Title} text=\"This route is for unauthed users\"/\u003e\n```\n\nAnd this one will call redirect them to '/admin' route.\n```js\n\u003cPublicRoute exact path=\"/public\" authed={true} redirectTo=\"/admin\" component={Title} text=\"This route is for unauthed users\"/\u003e\n```\n\n### Private Route\n\nIt requires two extra props.\n| Prop | Type |---|\n| ------ | ------ | ------ |\n| authed | boolean | If the user is authed or not |\n| redirectTo | string | route to redirect if necessary |\n\n**Only authed users can access it.**\n\nThe next exemple will call the Title component and will pass to it the text prop.\n```js\n\u003cPrivateRoute exact path=\"/private\" authed={true} redirectTo=\"/login\" component={Title} text=\"This is a private route\"/\u003e\n```\n\nAnd this one will call redirect them to '/login' route.\n```js\n\u003cPrivateRoute exact path=\"/private\" authed={false} redirectTo=\"/login\" component={Title} text=\"This is a private route\"/\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcbenlloch%2Freact-router-with-props","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgcbenlloch%2Freact-router-with-props","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcbenlloch%2Freact-router-with-props/lists"}