{"id":17242826,"url":"https://github.com/imcuttle/react-pizza","last_synced_at":"2026-01-20T02:24:15.932Z","repository":{"id":33659243,"uuid":"156528391","full_name":"imcuttle/react-pizza","owner":"imcuttle","description":"The utility for create (p)react component habitat.","archived":false,"fork":false,"pushed_at":"2022-12-08T04:43:34.000Z","size":920,"stargazers_count":2,"open_issues_count":10,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T02:34:04.799Z","etag":null,"topics":["independent","preact","react","standalone"],"latest_commit_sha":null,"homepage":"","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/imcuttle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2018-11-07T10:18:23.000Z","updated_at":"2022-04-14T14:39:18.000Z","dependencies_parsed_at":"2023-01-15T01:52:14.360Z","dependency_job_id":null,"html_url":"https://github.com/imcuttle/react-pizza","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/imcuttle%2Freact-pizza","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Freact-pizza/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Freact-pizza/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imcuttle%2Freact-pizza/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imcuttle","download_url":"https://codeload.github.com/imcuttle/react-pizza/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247451657,"owners_count":20940944,"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":["independent","preact","react","standalone"],"created_at":"2024-10-15T06:14:10.749Z","updated_at":"2026-01-20T02:24:15.905Z","avatar_url":"https://github.com/imcuttle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-pizza\n\n[![Build status](https://img.shields.io/travis/imcuttle/react-pizza/master.svg?style=flat-square)](https://travis-ci.org/imcuttle/react-pizza)\n[![Test coverage](https://img.shields.io/codecov/c/github/imcuttle/react-pizza.svg?style=flat-square)](https://codecov.io/github/imcuttle/react-pizza?branch=master)\n[![NPM version](https://img.shields.io/npm/v/react-pizza.svg?style=flat-square)](https://www.npmjs.com/package/react-pizza)\n[![NPM Downloads](https://img.shields.io/npm/dm/react-pizza.svg?style=flat-square\u0026maxAge=43200)](https://www.npmjs.com/package/react-pizza)\n[![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://prettier.io/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square)](https://conventionalcommits.org)\n\n\u003e The utility for creating (p)react component habitat.\n\n## Feature\n\n- Support react and [preact](https://github.com/developit/preact)\n- Set props and call method or get attribute which [preact-habitat](https://github.com/zouhir/preact-habitat) is not supported\n\n## Installation\n\n```bash\nnpm install react-pizza\n# or use yarn\nyarn add react-pizza\n```\n\n## Usage\n\n```javascript\nimport * as React from 'react'\nimport * as pizza from 'react-pizza'\n\nclass Timer extends React.Component {\n  state = {\n    count: this.props.count\n  }\n\n  increase() {\n    this.setState({ count: this.state.count + 1 })\n  }\n\n  render() {\n    return \u003cp\u003e{this.state.count}\u003c/p\u003e\n  }\n}\n\n// document.body\n// \u003cdiv id=\"root\"\u003e\u003c/div\u003e\nconst render = pizza(Timer)\nconst timer = render('#root', { count: 10 })\n// \u003cdiv id=\"root\"\u003e\u003cp\u003e10\u003c/p\u003e\u003c/div\u003e\n\ntimer.call('increase') // Call `increase` method\n// \u003cdiv id=\"root\"\u003e\u003cp\u003e11\u003c/p\u003e\u003c/div\u003e\ntimer.ref(0).current.state === timer.ref()[0].current.state) === timer.call('state', 0)\n// { count: 11 }\n\n// Set the props of all elements\ntimer.setProps({ count: 10 })\n// Set the prop of #root element\ntimer.setProps({ count: 10 }, document.querySelect('#root'))\n// Set the prop of first element\ntimer.setProps({ count: 10 }, 0)\n\n// Unmount timer in all elements\ntimer.remove()\n\ntimer.remove(0)\ntimer.remove(document.querySelect('#root'))\n\n// Mount origin\ntimer.origin === render.origin\ntimer.origin === Timer\n```\n\n## Contributing\n\n- Fork it!\n- Create your new branch:  \n  `git checkout -b feature-new` or `git checkout -b fix-which-bug`\n- Start your magic work now\n- Make sure npm test passes\n- Commit your changes:  \n  `git commit -am 'feat: some description (close #123)'` or `git commit -am 'fix: some description (fix #123)'`\n- Push to the branch: `git push`\n- Submit a pull request :)\n\n## Authors\n\nThis library is written and maintained by imcuttle, \u003ca href=\"mailto:moyuyc95@gmail.com\"\u003emoyuyc95@gmail.com\u003c/a\u003e.\n\n## License\n\nMIT - [imcuttle](https://github.com/imcuttle) 🐟\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimcuttle%2Freact-pizza","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimcuttle%2Freact-pizza","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimcuttle%2Freact-pizza/lists"}