mirror of
https://github.com/facebook/react.git
synced 2026-02-26 18:58:05 +00:00
17 lines
228 B
JavaScript
17 lines
228 B
JavaScript
function Component(props) {
|
|
const x = {};
|
|
let fn;
|
|
if (props.cond) {
|
|
// mutable
|
|
fn = () => {
|
|
x.value = props.value;
|
|
};
|
|
} else {
|
|
// immutable
|
|
fn = () => {
|
|
x.value;
|
|
};
|
|
}
|
|
return fn;
|
|
}
|