const { useState } = React;
const App = () => {
const [count, setCount] = useState(0);
const [inputValue, setInputValue] = useState('')
const update = ({ target }) => {
const { value } = target;
const attemptedParse = parseInt(value);
if (!attemptedParse) {
setInputValue(value);
setCount(0);
} else {
setInputValue(attemptedParse);
setCount(attemptedParse);
}
}
return (
<div>
<h1>{count}</h1>
<input value={inputValue} onChange={update} />
</div>
)
};
ReactDOM.render(<App />, document.getElementById('root'));
和<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.1/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.1/umd/react-dom.production.min.js"></script>
<div id="root"></div>
现在都只返回当前URL,而不是我的主页,因此链接只会刷新页面。这仅在生产中发生。是什么导致此问题?谢谢。
链接:
root_path
路线:
root_url