2017-09-30 8 views
0
を、私は巣にナビゲーションバーコンポーネント内のモード成分をしようとしている

のでは動作していないが、私は次のエラーを思い付く:モーダルが反応-マテリアライズ

Error: _processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal). 

マイコード:

import React, { Component } from 'react'; 
import { Navbar, NavItem, Modal, Button } from 'react-materialize'; 


class Header extends Component { 
    constructor(props) { 
    super(props); 
    this.state = { 
     showLoginModal: false 
    }; 
    this.toggleLoginModal = this.toggleLoginModal.bind(this); 
    } 

    toggleLoginModal() { 
    this.setState({ showLoginModal: !this.state.showLoginModal }); 
    } 


    render() { 
    console.log(this.state.showLoginModal); 
    return (
    <div> 
     <Navbar brand='Voting App' right> 
     <Modal 
      header='Login' 
      trigger={<Button>Login</Button>} 
     > 
      Login 
     </Modal> 
     </Navbar> 
    </div> 
    ) 
    } 
} 

export default Header; 

これがなぜそのようなのでしょうか?マテリアライズスタイリングを使って反応にモーダルを導入する最良の方法を理解しようとしていましたが、多くのレンガの壁に当たっていました。どんな助けも大歓迎です!

答えて

0

糸を0.xから1.xまたはNPMに応じてアップグレードし、もう一度試してください。このpostに基づいて動作するはずです。

+0

私はnpm(5.4.2)の最新バージョンを持っていますが、まだ動作しません:( – doctopus

関連する問題