G
G
gleendo2017-07-30 14:43:22
JavaScript
gleendo, 2017-07-30 14:43:22

How to use third party modules in react app without babel and webpack (propTypes)?

started reading a book on react. The conversation started at the beginning about propTypes. It seems like now it is not part of React and you need to pull it separately from npm. And to use it, you need to import it import PropTypes from "prop-types";
How to use this module without transpiling and module builder?
How can I run this code without third-party tools?

// import PropTypes from "prop-types";

let Component = React.createClass({
  propTypes: {
      name: PropTypes.string.isRequired
  },

  render: function() {
    return React.DOM.span(null, "My name is " + this.props.name);
  }
});

ReactDOM.render(
  React.createElement(Component, {
    name: "Alex"
  }),
  document.getElementById("app")
);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Gamega, 2017-07-30
@gadfi

How can I run this code without third-party tools?

what's the point?
require of course has not been canceled, but even large companies use create-react-app

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question