React TypeError: __WEBPACK_IMPORTED_MODULE_0_react__.PropTypes is undefined












1















I am making a react app using routers. It has 2 routers; post and profile. The code for them is as below:



Posts: import React,{Component} from 'react';


class Posts extends Component{
render(){
return <div> Posts </div>
}
}

export default Posts;
Profile:import React,{Component} from 'react';


class Profile extends Component{
render(){
return <div> Profile </div>
}
}

export default Profile;
and the index.js is:import React,{Component} from 'react';
import ReactDOM from 'react-dom';
import {BrowserRouter, Route} from 'react-router-dom';
import PropTypes from 'prop-types';

//COMPONENTS
import Posts from './Components/posts';
import Profile from './Components/profile';


class App extends Component{

render(){
return <div> home </div>

}
}


ReactDOM.render(
<BrowserRouter>
<div>
<Route path="/posts" component={Posts}> </Route>

<Route path="/profile" component={Profile}> </Route>

</div>
</BrowserRouter>

,document.querySelector('#root'))


I am getting the following error: React TypeError: __WEBPACK_IMPORTED_MODULE_0_react__.PropTypes is undefined



Here is a screenshot of the error: https://imgur.com/6ijKefx



and I can't figure it out. What am I doing wrong?










share|improve this question



























    1















    I am making a react app using routers. It has 2 routers; post and profile. The code for them is as below:



    Posts: import React,{Component} from 'react';


    class Posts extends Component{
    render(){
    return <div> Posts </div>
    }
    }

    export default Posts;
    Profile:import React,{Component} from 'react';


    class Profile extends Component{
    render(){
    return <div> Profile </div>
    }
    }

    export default Profile;
    and the index.js is:import React,{Component} from 'react';
    import ReactDOM from 'react-dom';
    import {BrowserRouter, Route} from 'react-router-dom';
    import PropTypes from 'prop-types';

    //COMPONENTS
    import Posts from './Components/posts';
    import Profile from './Components/profile';


    class App extends Component{

    render(){
    return <div> home </div>

    }
    }


    ReactDOM.render(
    <BrowserRouter>
    <div>
    <Route path="/posts" component={Posts}> </Route>

    <Route path="/profile" component={Profile}> </Route>

    </div>
    </BrowserRouter>

    ,document.querySelector('#root'))


    I am getting the following error: React TypeError: __WEBPACK_IMPORTED_MODULE_0_react__.PropTypes is undefined



    Here is a screenshot of the error: https://imgur.com/6ijKefx



    and I can't figure it out. What am I doing wrong?










    share|improve this question

























      1












      1








      1








      I am making a react app using routers. It has 2 routers; post and profile. The code for them is as below:



      Posts: import React,{Component} from 'react';


      class Posts extends Component{
      render(){
      return <div> Posts </div>
      }
      }

      export default Posts;
      Profile:import React,{Component} from 'react';


      class Profile extends Component{
      render(){
      return <div> Profile </div>
      }
      }

      export default Profile;
      and the index.js is:import React,{Component} from 'react';
      import ReactDOM from 'react-dom';
      import {BrowserRouter, Route} from 'react-router-dom';
      import PropTypes from 'prop-types';

      //COMPONENTS
      import Posts from './Components/posts';
      import Profile from './Components/profile';


      class App extends Component{

      render(){
      return <div> home </div>

      }
      }


      ReactDOM.render(
      <BrowserRouter>
      <div>
      <Route path="/posts" component={Posts}> </Route>

      <Route path="/profile" component={Profile}> </Route>

      </div>
      </BrowserRouter>

      ,document.querySelector('#root'))


      I am getting the following error: React TypeError: __WEBPACK_IMPORTED_MODULE_0_react__.PropTypes is undefined



      Here is a screenshot of the error: https://imgur.com/6ijKefx



      and I can't figure it out. What am I doing wrong?










      share|improve this question














      I am making a react app using routers. It has 2 routers; post and profile. The code for them is as below:



      Posts: import React,{Component} from 'react';


      class Posts extends Component{
      render(){
      return <div> Posts </div>
      }
      }

      export default Posts;
      Profile:import React,{Component} from 'react';


      class Profile extends Component{
      render(){
      return <div> Profile </div>
      }
      }

      export default Profile;
      and the index.js is:import React,{Component} from 'react';
      import ReactDOM from 'react-dom';
      import {BrowserRouter, Route} from 'react-router-dom';
      import PropTypes from 'prop-types';

      //COMPONENTS
      import Posts from './Components/posts';
      import Profile from './Components/profile';


      class App extends Component{

      render(){
      return <div> home </div>

      }
      }


      ReactDOM.render(
      <BrowserRouter>
      <div>
      <Route path="/posts" component={Posts}> </Route>

      <Route path="/profile" component={Profile}> </Route>

      </div>
      </BrowserRouter>

      ,document.querySelector('#root'))


      I am getting the following error: React TypeError: __WEBPACK_IMPORTED_MODULE_0_react__.PropTypes is undefined



      Here is a screenshot of the error: https://imgur.com/6ijKefx



      and I can't figure it out. What am I doing wrong?







      reactjs react-router






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 4 '18 at 15:43









      hkjhadj1hkjhadj1

      46111




      46111
























          3 Answers
          3






          active

          oldest

          votes


















          0














          What version of React are you using?



          I got this error when upgrading to React 16, and changing my react lines in package.json to:



          "react-dom": "^15.1.1",
          "react": "^15.1.1",


          and then running npm install and npm start fixed it for me.






          share|improve this answer
























          • How can downgrading possibly be the right solution to this issue?

            – silkfire
            Nov 27 '18 at 20:58











          • @silkfire IKR?! This is a workaround until React fixes the issue.

            – NH.
            Nov 28 '18 at 23:17



















          2














          I had the same problem and late noticed that I had a typo in my import statement.



          Instead of:



          import React from "react"


          I had:



          import {React} from "react"





          share|improve this answer































            0














            fixed it in "react-dom": "^16.6.3",by changing



            import React,{Component} from 'react';    
            class App extends Component{
            render(){
            return <div> home </div>
            }
            }


            to



            import React from 'react';    
            class App extends React.Component{
            render(){
            return <div> home </div>
            }
            }


            Hope it helps :)






            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49655272%2freact-typeerror-webpack-imported-module-0-react-proptypes-is-undefined%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              What version of React are you using?



              I got this error when upgrading to React 16, and changing my react lines in package.json to:



              "react-dom": "^15.1.1",
              "react": "^15.1.1",


              and then running npm install and npm start fixed it for me.






              share|improve this answer
























              • How can downgrading possibly be the right solution to this issue?

                – silkfire
                Nov 27 '18 at 20:58











              • @silkfire IKR?! This is a workaround until React fixes the issue.

                – NH.
                Nov 28 '18 at 23:17
















              0














              What version of React are you using?



              I got this error when upgrading to React 16, and changing my react lines in package.json to:



              "react-dom": "^15.1.1",
              "react": "^15.1.1",


              and then running npm install and npm start fixed it for me.






              share|improve this answer
























              • How can downgrading possibly be the right solution to this issue?

                – silkfire
                Nov 27 '18 at 20:58











              • @silkfire IKR?! This is a workaround until React fixes the issue.

                – NH.
                Nov 28 '18 at 23:17














              0












              0








              0







              What version of React are you using?



              I got this error when upgrading to React 16, and changing my react lines in package.json to:



              "react-dom": "^15.1.1",
              "react": "^15.1.1",


              and then running npm install and npm start fixed it for me.






              share|improve this answer













              What version of React are you using?



              I got this error when upgrading to React 16, and changing my react lines in package.json to:



              "react-dom": "^15.1.1",
              "react": "^15.1.1",


              and then running npm install and npm start fixed it for me.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Apr 16 '18 at 21:05









              NH.NH.

              92411230




              92411230













              • How can downgrading possibly be the right solution to this issue?

                – silkfire
                Nov 27 '18 at 20:58











              • @silkfire IKR?! This is a workaround until React fixes the issue.

                – NH.
                Nov 28 '18 at 23:17



















              • How can downgrading possibly be the right solution to this issue?

                – silkfire
                Nov 27 '18 at 20:58











              • @silkfire IKR?! This is a workaround until React fixes the issue.

                – NH.
                Nov 28 '18 at 23:17

















              How can downgrading possibly be the right solution to this issue?

              – silkfire
              Nov 27 '18 at 20:58





              How can downgrading possibly be the right solution to this issue?

              – silkfire
              Nov 27 '18 at 20:58













              @silkfire IKR?! This is a workaround until React fixes the issue.

              – NH.
              Nov 28 '18 at 23:17





              @silkfire IKR?! This is a workaround until React fixes the issue.

              – NH.
              Nov 28 '18 at 23:17













              2














              I had the same problem and late noticed that I had a typo in my import statement.



              Instead of:



              import React from "react"


              I had:



              import {React} from "react"





              share|improve this answer




























                2














                I had the same problem and late noticed that I had a typo in my import statement.



                Instead of:



                import React from "react"


                I had:



                import {React} from "react"





                share|improve this answer


























                  2












                  2








                  2







                  I had the same problem and late noticed that I had a typo in my import statement.



                  Instead of:



                  import React from "react"


                  I had:



                  import {React} from "react"





                  share|improve this answer













                  I had the same problem and late noticed that I had a typo in my import statement.



                  Instead of:



                  import React from "react"


                  I had:



                  import {React} from "react"






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 27 '18 at 20:54









                  EriccurEriccur

                  212




                  212























                      0














                      fixed it in "react-dom": "^16.6.3",by changing



                      import React,{Component} from 'react';    
                      class App extends Component{
                      render(){
                      return <div> home </div>
                      }
                      }


                      to



                      import React from 'react';    
                      class App extends React.Component{
                      render(){
                      return <div> home </div>
                      }
                      }


                      Hope it helps :)






                      share|improve this answer




























                        0














                        fixed it in "react-dom": "^16.6.3",by changing



                        import React,{Component} from 'react';    
                        class App extends Component{
                        render(){
                        return <div> home </div>
                        }
                        }


                        to



                        import React from 'react';    
                        class App extends React.Component{
                        render(){
                        return <div> home </div>
                        }
                        }


                        Hope it helps :)






                        share|improve this answer


























                          0












                          0








                          0







                          fixed it in "react-dom": "^16.6.3",by changing



                          import React,{Component} from 'react';    
                          class App extends Component{
                          render(){
                          return <div> home </div>
                          }
                          }


                          to



                          import React from 'react';    
                          class App extends React.Component{
                          render(){
                          return <div> home </div>
                          }
                          }


                          Hope it helps :)






                          share|improve this answer













                          fixed it in "react-dom": "^16.6.3",by changing



                          import React,{Component} from 'react';    
                          class App extends Component{
                          render(){
                          return <div> home </div>
                          }
                          }


                          to



                          import React from 'react';    
                          class App extends React.Component{
                          render(){
                          return <div> home </div>
                          }
                          }


                          Hope it helps :)







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Dec 22 '18 at 4:53









                          EphemeralEphemeral

                          1




                          1






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f49655272%2freact-typeerror-webpack-imported-module-0-react-proptypes-is-undefined%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Contact image not getting when fetch all contact list from iPhone by CNContact

                              count number of partitions of a set with n elements into k subsets

                              A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks