{"id":27060487,"url":"https://github.com/codewithdpk/react-data-layer","last_synced_at":"2025-07-12T15:12:45.566Z","repository":{"id":57333106,"uuid":"377928645","full_name":"codewithdpk/react-data-layer","owner":"codewithdpk","description":"A data layer for react applications to prohibits unnecessary loading of same data by creating cache of data inside session storage.  🚀","archived":false,"fork":false,"pushed_at":"2021-06-17T19:39:25.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T13:06:22.289Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/codewithdpk.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":"2021-06-17T18:38:12.000Z","updated_at":"2021-06-17T19:43:28.000Z","dependencies_parsed_at":"2022-08-26T03:10:56.895Z","dependency_job_id":null,"html_url":"https://github.com/codewithdpk/react-data-layer","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/codewithdpk%2Freact-data-layer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithdpk%2Freact-data-layer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithdpk%2Freact-data-layer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithdpk%2Freact-data-layer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codewithdpk","download_url":"https://codeload.github.com/codewithdpk/react-data-layer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339490,"owners_count":20923076,"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":[],"created_at":"2025-04-05T13:19:51.753Z","updated_at":"2025-04-05T13:19:52.575Z","avatar_url":"https://github.com/codewithdpk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-data-layer\n\nA data layer for reacts applications prohibits unnecessary loading of the same data by creating a cache of data inside session storage. 🚀\n\n## Installation\n\n```bash\nnpm i react-data-layer-api\n```\n\n## Usage\n\n```javascript\nimport { checkData,fetchData,updateNewData, FLAGS } from 'react-data-layer-api';\n\nconst App = () =\u003e{\n\n    const [Products,setProducts] = useState([]);\n\n    useEffect(()=\u003e{\n        /* checking if data is already loaded while component\n          mounted first time in the app */\n        /* pass your key */\n        if(checkData(\"home_data\") == FLAGS.DATA_EXIST){\n            /* do not need to load data again, fetching data\n            from session */\n            /* or it will\n            return if there is no data DATA_NOT_FOUND flag */\n            const products = fetchData(\"home_data\");\n            setProducts(products);\n        }else{\n            /* it will load basically when this\n            component will be rederred first\n            time in the whole session */\n            /* perform request */\n            fetch(url,{\n                type:'GET/POST',\n                header:{`your headers`}\n                body:{}\n            }).then((response)=\u003eresponse.json())\n            .then((data)=\u003e{\n                setProducts(data);\n                /* save data to session, will\n                return DATA_SAVED flag for confirmation */\n                updateNewData(data,\"home_data\");\n            }).catch((err)=\u003econsole.log(err));\n        }\n    },[]);\n}\n```\n\nYou can create multiple layers of different data from other sections in the app. I will be updating more features soon in this like API integration, bulk cache, and all.🔥\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithdpk%2Freact-data-layer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithdpk%2Freact-data-layer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithdpk%2Freact-data-layer/lists"}