mirror of
https://github.com/facebook/react.git
synced 2026-02-26 04:24:58 +00:00
15 lines
166 B
JavaScript
15 lines
166 B
JavaScript
function Component(props) {
|
|
const [x, setX] = useState(0);
|
|
|
|
const foo = () => {
|
|
setX(1);
|
|
};
|
|
|
|
if (props.cond) {
|
|
setX(2);
|
|
foo();
|
|
}
|
|
|
|
return x;
|
|
}
|