Devam browserify kullanma: Ben wepback veya benzer araçlar olmadan Yönlendirici Tepki çalıştırmanız gerekir. Doğrudan CDN bağlantılardan, ancak bazı require.js hata ile sıkışmış. CDN ile ve WebPack olmadan Router Tepki veya
İlk Uygulamayı React ile oluşturmaya başladım ve React Router ile boğuşuyorum.
HTML:
<body>
<div id="container"></div>
<script src="https://unpkg.com/[email protected]/dist/react.js"></script>
<script src="https://unpkg.com/[email protected]/dist/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.js"></script>
<script src="https://npmcdn.com/[email protected]/umd/ReactRouter.js"></script>
<script type="text/babel" src="assets/scripts/03_templates/app.js" charset="utf-8"></script>
</body>
JS:
var { Router, Route, IndexRoute, hashHistory, IndexLink, Link, browserHistory } = ReactRouter;
//some classes
ReactDOM.render((
<Router history={hashHistory}>
<Route path="/" component={Window}>
<IndexRoute component={InitialPage}/>
<Route path="register" component={Register} />
<Route path="search" component={Search} />
</Route>
</Router>
), document.getElementById("container"));
Her şey iyi çalışıyorsa ama konsolda bu olsun:
react.js:3639 Warning: You are manually calling a React.PropTypes validation function for the
getComponent
prop onIndexRoute
. This is deprecated and will not work in production with the next major version. You may be seeing this warning due to a third-party PropTypes library.
Yani, benim herhalde Yönlendirici bir eski tepki sürümü. Ben
Bu konuda arama<script src="https://cdnjs.cloudflare.com/ajax/libs/react-router/4.0.0-0/react-router.js"></script>
Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).
bağlantısını değiştirmiş olup, bunun sorunun hattı 1. Yani bu değişmiş görünüyor: Buna
var { Router, Route, IndexRoute, hashHistory, IndexLink, Link, browserHistory } = ReactRouter;
:
import { Router, Route, IndexRoute, hashHistory, IndexLink, Link, browserHistory } from 'react-router';
Ve şimdi bu sorun var:
Ben require.js aramış bazı şeyler denedik ama hiçbir şey benim sorun giderildi. Neyi kaçırıyorum? Bunu web paketi veya benzeri araçlar olmadan çalıştırmam gerekiyor.teşekkürler javascript üstünde
4.0.0 ile benzer bir şey denedim ve çalışmadı. 3.0.0 ile çok kolay hayır çok teşekkür ederim! –