# ipreact-for-react **Repository Path**: shy9120/ipreact-for-react ## Basic Information - **Project Name**: ipreact-for-react - **Description**: ipreact-for-react - **Primary Language**: TypeScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-07-31 - **Last Updated**: 2025-06-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # IPreactForReact connect data-actions of react-components see: [ipreact](https://gitee.com/shy9120/ipreact-for-react) ## Install ``` npm i ipreact-for-react ``` ## Usage ```tsx import createStore, { IPreact, Connect } from '../src/ipreact' import * as React from 'react' import { createRoot } from 'react-dom/client' interface IStoreState { name?: string; } const { connect, dispatch, getState } = createStore()({ name: 'world' }) interface AppProps { words?: string; prefix?: string; } const AppComponent = ({ words, prefix }: AppProps) =>

{prefix} {words}

const App = connect(() => { return { words: getState().name } })(AppComponent) let i = 0 setInterval(function () { const list = ['preact', 'immutable', 'world', 'ipreact'] i = (i + 1) % list.length dispatch(state => ({...state, name: list[i]})) }, 1000) const root = createRoot(document.querySelector('#app')) root.render() ``` ![hello world](./helloworld.gif)