{"id":13499618,"url":"https://github.com/dustingetz/react-cursor","last_synced_at":"2025-10-22T20:07:07.064Z","repository":{"id":18598427,"uuid":"21803233","full_name":"dustingetz/react-cursor","owner":"dustingetz","description":"Immutable state for React.js","archived":true,"fork":false,"pushed_at":"2017-01-27T19:51:23.000Z","size":1735,"stargazers_count":1032,"open_issues_count":10,"forks_count":50,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-10-29T23:10:17.433Z","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/dustingetz.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":"2014-07-14T00:55:05.000Z","updated_at":"2024-10-23T00:49:23.000Z","dependencies_parsed_at":"2022-08-31T00:31:06.760Z","dependency_job_id":null,"html_url":"https://github.com/dustingetz/react-cursor","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustingetz%2Freact-cursor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustingetz%2Freact-cursor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustingetz%2Freact-cursor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustingetz%2Freact-cursor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dustingetz","download_url":"https://codeload.github.com/dustingetz/react-cursor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222465512,"owners_count":16989030,"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":"2024-07-31T22:00:36.723Z","updated_at":"2025-10-22T20:07:01.725Z","avatar_url":"https://github.com/dustingetz.png","language":"JavaScript","readme":"react-cursor\n===============\n\n\u003e Immutable state for React.js\n\n[react-cursor hello-world in a fiddle](https://jsfiddle.net/dustingetz/n9kfc17x/)\n\n[![live demo](screenshot.png?raw=true)](http://demo-react-json-editor.s3-website-us-east-1.amazonaws.com/)\n\n## What is react-cursor\n\nCursors are a tool for working with recursive or deeply nested data, immutably. react-cursor is a javascript port of an abstraction that I first saw in ClojureScript. This implementation is decoupled from any rendering library and is very small.\n\nCursors are useful in UI programming, because UIs are tree shaped and naturally have tree-shaped state. Cursors let your app hold all its state in one place at the root of the UI tree; thus the root is stateful, and all downtree views are stateless.\n\n## Project Maturity\n\nmaster is stable, there is a full test suite.\n\n## API\n\n`Cursor` interface has three methods: `value`, `swap` and `refine`.\n * `cur.value()` return the value in the cursor at some path.\n * `cur.refine(path, ...paths)` return a cursor nested inside another cursor\n * `cur.swap(f)` apply f to the value in the cursor value and puts returned value into the backing store\n\nFor frequently used swap functions, see the bundled `update-in` dependency: see [here](https://github.com/dustingetz/update-in). Cursor instances have optional syntax sugar for the swap fns provided by update-in; see [CursorOperations.js](https://github.com/dustingetz/react-cursor/blob/master/src/CursorOperations.js)\n\n## FAQ\n * Cursors have value semantics, don't mutate values that come out of a cursor\n * Equal cursors are `===` for easy and efficient optimized rendering (see hello world jsfiddle for example)\n * You should read the source! The [core cursor abstraction is 15 lines of code](https://github.com/dustingetz/react-cursor/blob/master/src/Cursor.js)\n * There is an undocumented alternate implementation, `RefCursor`, which has reference semantics, this is only useful for working with legacy mutable code\n\n## License\n\n_`react-cursor` is governed under the MIT License._\n\n## Attributions\n\nreact-cursor was built by Daniel Miladinov and Dustin Getz.\n","funding_links":[],"categories":["Awesome React","JavaScript","Uncategorized"],"sub_categories":["Tools","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdustingetz%2Freact-cursor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdustingetz%2Freact-cursor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdustingetz%2Freact-cursor/lists"}