Skip to content

Commit 4485b40

Browse files
authored
docs(cndocs): remove React.useState/useRef prefix in new-architecture docs (#1036)
- custom-cxx-types.md: React.useState → useState (5 occurrences) - layout-measurements.md: React.useRef → useRef (1 occurrence) Aligns with upstream React import removal pattern (React 17+ JSX transform).
1 parent 055e1af commit 4485b40

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎cndocs/the-new-architecture/custom-cxx-types.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ First, we need to update the `App.tsx` file to use the new method from the Turbo
173173

174174
```diff title="App.tsx"
175175
// ...
176-
+ const [cubicSource, setCubicSource] = React.useState('')
177-
+ const [cubicRoot, setCubicRoot] = React.useState(0)
176+
+ const [cubicSource, setCubicSource] = useState('')
177+
+ const [cubicRoot, setCubicRoot] = useState(0)
178178
return (
179179
<SafeAreaView style={styles.container}>
180180
<View>
@@ -366,9 +366,9 @@ To test the code in the app, we have to modify the `App.tsx` file.
366366
2. Replace the body of the `App()` function with the following code:
367367

368368
```tsx title="App.tsx (App function body replacement)"
369-
const [street, setStreet] = React.useState('');
370-
const [num, setNum] = React.useState('');
371-
const [isValidAddress, setIsValidAddress] = React.useState<
369+
const [street, setStreet] = useState('');
370+
const [num, setNum] = useState('');
371+
const [isValidAddress, setIsValidAddress] = useState<
372372
boolean | null
373373
>(null);
374374

‎cndocs/the-new-architecture/layout-measurements.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Typical code will look like this:
1010

1111
```tsx
1212
function AComponent(children) {
13-
const targetRef = React.useRef(null)
13+
const targetRef = useRef(null)
1414

1515
useLayoutEffect(() => {
1616
targetRef.current?.measure((x, y, width, height, pageX, pageY) => {

0 commit comments

Comments
 (0)