0
이것은 내 HTML 코드입니다. 몇 달 전에 제대로 작동 했습니까? Ubuntu에서 전체 경로를 복사하여 브라우저에서 실행하고 있습니다. 이것은 React가 그 일을하지 않는 것과 관련이 있습니까? 여기 내 반응은 렌더링되지 않습니다. 공백 만 표시합니다.
<div id='root'></div>
<script crossorigin src="https://unpkg.com/[email protected]/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
<script src="app.js" type="text/babel"></script>
내가 물건을 렌더링 내 JS의 일부입니다. 잘 작동해야합니다. 프로그램 자체에 기능을 부여하는 기능을 생략했습니다.
render: function() {
return (
<div className="todoListMain">
<div className="header">
<form onSubmit = {this.addItem}>
<input ref={(a) => this._inputElement = a}
placeholder="enter task">
</input>
<button type="submit">add</button>
</form>
</div>
<TodoItems entries={this.state.items}/>
</div>
);
}
});
ReactDOM.render(
<TodoList/>,
document.getElementById('root')
);
이 모든 작업은 이전에 잘 처리되었지만 그때는 Windows에서 wamp localhost를 사용했습니다.
모든 콘솔 오류가 있습니까? – jmargolisvt
좋은 지적. 사실 예, 나는 이것이 무엇을 의미하는지 완전히 이해하지 못합니다 : browser.min.js : 4 파일을로드하지 못했습니다 : ///home/riku/Nettisivut/React1/app.js : Cross origin 요청은 프로토콜 스킴에서만 지원됩니다. http, data, chrome, chrome-extension, https. – Riku
이것은 http가 아닌 http/https 요청에 CORS를 허용하지 않는 chrome에 의해 추가 된 최근 보안 기능과 관련이 있다고 생각합니다. http-server 또는 wamp가있는 로컬 서버에서 실행하면 문제가 해결됩니다. 비슷한 시나리오 : https://stackoverflow.com/questions/10752055/cross-origin-requests-are-only-supported-for-http-error-when-loading-a-local – Vorcan