Dan Abramov 2 years ago
parent
commit
d9915ca59a
  1. 4
      beta/src/content/apis/react/createFactory.md

4
beta/src/content/apis/react/createFactory.md

@ -181,7 +181,7 @@ Sometimes, your existing code might pass some variable as a `type` instead of a
```js {3}
function Heading({ isSubheading, ...props }) {
let type = isSubheading ? 'h2' : 'h1';
const type = isSubheading ? 'h2' : 'h1';
const factory = createFactory(type);
return factory(props);
}
@ -191,7 +191,7 @@ To do the same in JSX, you need to rename your variable to start with an upperca
```js {2,3}
function Heading({ isSubheading, ...props }) {
let Type = isSubheading ? 'h2' : 'h1';
const Type = isSubheading ? 'h2' : 'h1';
return <Type {...props} />;
}
```

Loading…
Cancel
Save