{"id":20401159,"url":"https://github.com/sohanemon/mama-john","last_synced_at":"2026-04-17T05:02:57.203Z","repository":{"id":60341418,"uuid":"542222378","full_name":"sohanemon/mama-john","owner":"sohanemon","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-07T18:15:12.000Z","size":3792,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-03T22:41:13.699Z","etag":null,"topics":["localstorage","react","tailwindcss"],"latest_commit_sha":null,"homepage":"https://mama-john.netlify.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sohanemon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-27T18:02:12.000Z","updated_at":"2022-12-30T14:53:31.000Z","dependencies_parsed_at":"2023-01-23T13:01:35.518Z","dependency_job_id":null,"html_url":"https://github.com/sohanemon/mama-john","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sohanemon/mama-john","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohanemon%2Fmama-john","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohanemon%2Fmama-john/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohanemon%2Fmama-john/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohanemon%2Fmama-john/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sohanemon","download_url":"https://codeload.github.com/sohanemon/mama-john/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohanemon%2Fmama-john/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31915900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["localstorage","react","tailwindcss"],"created_at":"2024-11-15T04:48:08.799Z","updated_at":"2026-04-17T05:02:57.151Z","avatar_url":"https://github.com/sohanemon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Back to home route\n\n```js\nif (window.location.pathname !== \"/\") window.location.pathname = \"/\";\n```\n\n\u003e go to route page at any cost. Alternative to Netlify's \\_redirects\n\n## Deal firebase error\n\n```js\nexport const sliceError = (error) =\u003e {\n  return error.message.split(\"/\")[1].split(\")\")[0].replaceAll(\"-\", \" \");\n};\n```\n\n## Avoid too much useContext Definition\n\n```js\n// working directory\n\nimport { useContext } from \"react\";\nimport { UserContext } from \"./user-provider\";\n\nconst { loginWithGoogle } = useContext(UserContext);\n```\n\nuse as follow\n\n```js\n// root directory\nconst useUser = () =\u003e useContext(UserContext);\n\n// working directory\n\nconst { loginWithGoogle } = useUser();\n```\n\n## Redirect to previous path after private route\n\n- navigate with state \u0026 replace\n\n```js\n//private route.jsx\nconst PrivateRoute = ({ children }) =\u003e {\n  const { pathname } = useLocation();\n  if (user?.uid) return children;\n\n  return \u003cNavigate state={{ pathname }} to={\"/login\"} replace\u003e\u003c/Navigate\u003e;\n  // navigated from pathname\n  // passing a props named state\n};\n```\n\n\u003e state props will be injected to the location of `/login`\n\n- get the pathname\n\n```js\n// login.jsx\nconst {\n  state: { pathname },\n} = useLocation();\n// or\nconst location = useLocation();\nconst pathname = location?.state?.pathname;\n```\n\n- now we know the previous location and go with\n\n```js\n//login.jsx\nsetTimeout(() =\u003e navigate(pathname || \"/\"), 100);\n```\n\n# Codemon\n\n\u003e absolute content takes `width: max-content` automatically\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsohanemon%2Fmama-john","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsohanemon%2Fmama-john","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsohanemon%2Fmama-john/lists"}