# tinyReact **Repository Path**: luzeya/tiny-react ## Basic Information - **Project Name**: tinyReact - **Description**: 手写的玩具React 仅支持函数式组件和Hook bug很多 希望大家轻喷 简单适配了layui - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-04-24 - **Last Updated**: 2022-04-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 使用说明 (需要跑在webpack环境下) npm install ## 创建组件 ```tsx // js 引入方法 创建函数组件 渲染到页面 import { render,myUseEffect, myUseState } from './js/myReact.dev' function App() { return `

App

` } render(App, document.getElementById('root')) ``` ### 绑定事件和使用子组件 ```tsx function addNum() { console.log('执行函数') } function Item() { return `` } //需要将子组件和函数挂在全局 使用onClick={}绑定 window.$$Item = Item window.$$addNum = addNum ``` ### 组件中传递props 使用{{}}双大括号 ## 使用注意 1. 只能使用双标签 暂时不支持单标签解析 2. 需要将子组件和函数挂在全局