the React Counter app
2022年5月1日小于 1 分钟
the React Counter app
Question
As the first React problem, you are asked to create the famous Counter app.
- counter starts from 0.
- click the '+' button to increment.
- click the '-' button to decrement.
data-testid
is used to test your code, please keep them.
Code
import React from 'react'
export function App() {
return (
<div>
<button data-testid="decrement-button">-</button>
<button data-testid="increment-button">+</button>
<p>clicked: 0</p>
</div>
)
}
// run your code by clicking the run button on the right