UI -- React

React 模板

React UI

  • package.json同级
  • components/slButton/element.jsx
import React from 'react';

const el = ({ text, onClick }) => {
    return (
        <button onClick={onClick}>
            {text}
        </button>
    );
};

export default el;
  • components/function.js
export const ceshi = ()=>{
    console.log('123')
}
  • components/index.js
export { default as SlButton } from './slButton/element';
export {ceshi} from  './function'

使用

import  {SlButton,ceshi} from "../components/index"
function App() {
    const handleClick = ()=>{
        console.log("123")
        ceshi()
    }

    return (
        <>
            <SlButton text="Click me" onClick={handleClick} />
        </>
    );
}

export default App;

UI 文档

  • package.json 同级
  • docs 创建
npx create-dumi
# React Library react组件库
# npm start     运行
# 根据自己需要修改

你可能感兴趣的:(reservoir,ui,react.js)