This is the source code.
import React, { useState } from "react"
import ReactDOM from "react-dom"
import "./styles.css"
function App() {
const [arr, setArr] = useState([1,2,3])
return (
<div className="App">
<h1>
Length:{arr.length}
</h1>
<h2>
Values:
{arr.map(i=>i+',')}
</h2>
<button
onClick={() => {
arr.push(0) //my wrong code
setArr(arr) //my wrong code
//
…
Top comments (0)