{"id":20380503,"url":"https://github.com/tobua/linex","last_synced_at":"2026-04-19T01:32:32.316Z","repository":{"id":143886168,"uuid":"147976391","full_name":"tobua/linex","owner":"tobua","description":"Refined State Management","archived":false,"fork":false,"pushed_at":"2020-07-21T10:59:17.000Z","size":362,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-21T01:18:18.433Z","etag":null,"topics":["immutability","react","state-management"],"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/tobua.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-08T23:08:45.000Z","updated_at":"2020-07-21T10:59:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"49df4e84-a90a-43ff-9072-8f9717015c34","html_url":"https://github.com/tobua/linex","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":0.09999999999999998,"last_synced_commit":"0dd4c165bf1f864201c030088ac7448e9ed0858e"},"previous_names":["naminho/linex"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobua%2Flinex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobua%2Flinex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobua%2Flinex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobua%2Flinex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobua","download_url":"https://codeload.github.com/tobua/linex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241929737,"owners_count":20044019,"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":["immutability","react","state-management"],"created_at":"2024-11-15T02:07:31.067Z","updated_at":"2026-04-19T01:32:27.254Z","avatar_url":"https://github.com/tobua.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linex\n\nRefined State Management, pronounced as /ˈlɪnəks/.\n\n## Installation\n\n```\nnpm i linex\n```\n\n## Features\n\n* Read State (Selectors)\n* Update State (Actions)\n* Effortless Immutability\n* Async Side-Effects\n* Memoized Reads\n* Plugins (Middleware)\n* React Integration\n* IE11 Support\n* [Reusable Stores](https://github.com/naminho/linex/tree/master/stores)\n\n## Standalone Usage\n\n```js\nimport { create } from 'linex'\n\nconst store = create({\n  // Define the initial state.\n  state: {\n    count: 0\n  },\n  // Used to update the state.\n  update: {\n    increment: state =\u003e ++state.count,\n    incrementBy: (state, store, value) =\u003e state.count += value,\n    incrementDelayed: (state, store) =\u003e {\n      return store.later((done) =\u003e {\n        setTimeout(() =\u003e done(store.increment()), 1000)\n      })\n    }\n  },\n  // Methods to get values derived from the state.\n  read: {\n    double: state =\u003e state.count * 2,\n    doubleMemoized: [\n      state =\u003e state.count,\n      count =\u003e count * 2\n    ]\n  }\n})\n\n// State\nstore.count                                          // =\u003e 0, store.count: 0\n// Update\nstore.increment()                                    // =\u003e 1, store.count: 1\nstore.incrementBy(2)                                 // =\u003e 3, store.count: 3\n// Read\nstore.double()                                       // =\u003e 6\n// Memoized Read, only called once if props stay the same.\nstore.doubleMemoized()                               // =\u003e 6\nstore.doubleMemoized()                               // =\u003e 6, but from cache.\n// Async Update\nconst { value } = await store.incrementDelayed()     // store.count: 4, value: 4\n```\n\n## Usage with React\n\nComes with built-in helpers for React integration.\n\n```js\nimport React from 'react'\nimport { render } from 'react-dom'\nimport { create, Component } from 'linex'\n\nconst store = create({\n  state: { count: 0 },\n  update: {\n    increment: state =\u003e ++state.count\n  }\n})\n\nclass DisplayCount extends Component {\n  render() {\n    const { count, increment } = this.state\n\n    return (\n      \u003cdiv\u003e\n        \u003cp\u003e{count}\u003c/p\u003e\n        \u003cbutton onClick={() =\u003e increment()}\u003eIncrement\u003c/button\u003e\n      \u003c/div\u003e\n    )\n  }\n}\n\nconst mapStore = store =\u003e ({ count: store.count, increment: store.increment })\n\nrender(\u003cDisplayCount mapStore={mapStore} /\u003e, document.getElementById('root'))\n```\n\n## Nested Stores\n\nIt's possible to split up sub-parts of the state into separate stores. The last\ncall to create automatically denotes the root store that can be accessed from\nanywhere with get().\n\n```js\nimport { create, get } from 'linex'\n\nconst store = create({\n  state: {\n    count: 0,\n    nested: create({\n      state: {\n        count: 1\n      }\n    })\n  }\n})\n\nstore.nested.count // =\u003e 1\nget().nested.count // =\u003e 1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobua%2Flinex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobua%2Flinex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobua%2Flinex/lists"}