2017-03-29 15 views
-1

React.jsとR& Dが新しくなりました。React 0.14.XバージョンはIE 8ブラウザをサポートしています。 Babel(JSX Transformer)Browser.jsはIE8ブラウザでは動作しません。 IE8ブラウザに関してはコンソールにエラーはありません。 React jsのアーキテクチャ全体をIE 8をサポートするJSXでもお勧めします。JSXとES6を使用してIE8のサポートを受ける方法はありますか?

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
    <title>My First React Example</title> 
    </head> 
    <body> 
    <div id="react-app"></div> 

    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.8/react.min.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.8/react-dom.min.js"></script> 


    <script> 
    var contacts = [ 
       {key: 1, name: "Anurag Dadheech", email: "[email protected]", description: "This is descrption"}, 
       {key: 2, name: "Priyank Soni", email: "[email protected]"}, 
       {key: 3, name: "Jayesh Helaiya", email: "[email protected]"}, 
      ] 

      var ContactItem = React.createClass({ 
       propTypes: { 
       name: React.PropTypes.string.isRequired, 
       email: React.PropTypes.string.isRequired, 
       description: React.PropTypes.string, 
       }, 

       render: function() { 
       // I wrap mult-line return statements in parentheses to avoid the 
       // inevitable bugs caused by forgetting that JavaScript will throw away 
       // the final lines when possible. The parentheses are not strictly 
       // necessary. 
       return (
        React.createElement('li', {}, 
        React.createElement('h2', {}, this.props.name), 
        React.createElement('a', {href: 'mailto:'+this.props.email}, this.props.email), 
        React.createElement('div', {}, this.props.description) 
       ) 
       ) 
       }, 
      }) 

      var contactItemElements = contacts 
       .filter(function(contact) { return contact.email }) 
       .map(function(contact) { return React.createElement(ContactItem, contact) }) 

      var rootElement = 
       React.createElement('div', {}, 
       React.createElement('h1', {}, "Contacts"), 
       React.createElement('ul', {}, contactItemElements) 
      ) 

      ReactDOM.render(rootElement, document.getElementById('react-app')) 
    </script> 
    </body> 
</html> 

それはChromeとFirefoxで正常に動作しますが、IE 8には、それは

__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' is null or not and object 
+1

正確なエラーを表示してください。また、あなたは何を使っていますか、webapck、browserify、Grunt?あなたの設定ファイルを見ることはできますか?ありがとう –

+0

実際に私たちはプロジェクトの作業を開始していませんが、すべての側面がIE 8で動作することを確認するので、私はデモアプリケーションを作成しました。 –

+0

@Stelios Voskosコードを投稿してエラーを報告してください –

答えて

0

がjsのコミュニティに反応与え、彼らは0.14.xのためにIE8のサポートを提供しますが、ユーティリティのほとんどは、それようIE8で動作していないと言いますあなたがangularjs 1.2.xに行くなら良いです。 IE8に関して多くのサポートがあります。あなたは決して後悔しません。

関連する問題