Skip to content

Commit 4eee597

Browse files
authored
docs: fix example input event code errors (#1223)
* docs: add missing const declarations * docs: use screen instead of utils the getByLabelText on line 35 was underlined in red saying to use screen instead
1 parent bddff54 commit 4eee597

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/example-input-event.mdx

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ sidebar_label: Input Event
1111
1212
```jsx
1313
import React, {useState} from 'react'
14-
import {render, fireEvent} from '@testing-library/react'
14+
import {screen, render, fireEvent} from '@testing-library/react'
1515

1616
function CostInput() {
1717
const [value, setValue] = useState('')
1818

19-
removeDollarSign = value => (value[0] === '$' ? value.slice(1) : value)
20-
getReturnValue = value => (value === '' ? '' : `$${value}`)
19+
const removeDollarSign = value => (value[0] === '$' ? value.slice(1) : value)
20+
const getReturnValue = value => (value === '' ? '' : `$${value}`)
2121

22-
handleChange = ev => {
22+
const handleChange = ev => {
2323
ev.preventDefault()
2424
const inputtedValue = ev.currentTarget.value
2525
const noDollarSign = removeDollarSign(inputtedValue)
@@ -32,7 +32,7 @@ function CostInput() {
3232

3333
const setup = () => {
3434
const utils = render(<CostInput />)
35-
const input = utils.getByLabelText('cost-input')
35+
const input = screen.getByLabelText('cost-input')
3636
return {
3737
input,
3838
...utils,

0 commit comments

Comments
 (0)