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;
export const ceshi = ()=>{
console.log('123')
}
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 文档
npx create-dumi