当我尝试执行此代码时,Codesanbox.io 中出现“引发了跨域错误”错误。请问我该怎么做才能过去?我将 Create-react-app 与 codesanbox.io 一起使用
import React from "react";
import ReactDOM from "react-dom";
import "./styles.css";
class App extends React.Component {
state = {
customer: [
{ id: 1, name: "Leon" },
{ id: 1, name: "Lea" },
{ id: 1, name: "Vanelle" }
]
};
render() {
const title = "Customer list";
const elements = this.state.customer.map();
return (
<div className="App">
<h1>{title}</h1>
<ul>
<li>
Philippe <button>X</button>
</li>
</ul>
<form>
<input type="text" placeholder="Add a customer" />
<button>Confirm</button>
</form>
</div>
);
}
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);