File tree Expand file tree Collapse file tree 4 files changed +33
-1
lines changed
react-component-bundle-false Expand file tree Collapse file tree 4 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 11{
2- "name" : " mf- example" ,
2+ "name" : " @ example/mf " ,
33 "scripts" : {
44 "mf:dev" : " pnpm --filter mf-host dev & pnpm --filter mf-remote dev & pnpm --filter react-component run serve"
55 }
Original file line number Diff line number Diff line change 1+ # @examples/react-component
2+
3+ This example demonstrates how to use Rslib to build a simple React component.
Original file line number Diff line number Diff line change 1+ import styles from './index.module.scss' ;
2+ interface CounterButtonProps {
3+ onClick : ( ) => void ;
4+ label : string ;
5+ }
6+
7+ export const CounterButton : React . FC < CounterButtonProps > = ( {
8+ onClick,
9+ label,
10+ } ) => (
11+ < button type = "button" className = { styles . button } onClick = { onClick } >
12+ { label }
13+ </ button >
14+ ) ;
Original file line number Diff line number Diff line change 1+ import { CounterButton } from './components/CounterButton/index' ;
2+ import { useCounter } from './useCounter' ;
3+ import './index.scss' ;
4+
5+ export const Counter : React . FC = ( ) => {
6+ const { count, increment, decrement } = useCounter ( ) ;
7+
8+ return (
9+ < div >
10+ < h2 className = "counter-text" > Counter: { count } </ h2 >
11+ < CounterButton onClick = { decrement } label = "-" />
12+ < CounterButton onClick = { increment } label = "+" />
13+ </ div >
14+ ) ;
15+ } ;
You can’t perform that action at this time.
0 commit comments