score:4

Accepted answer
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
<div id="container">
    <!-- This element's contents will be replaced with your component. -->
</div>

score:0

import React from "react";
import PropTypes from 'prop-types';

const Button = ({ onClick }) => {
  return(
    <div>
      <button onClick={onClick}>Hello world</button>
    </div>
  )
}

Button.defaultProps = {
  onClick: () => null,
};
Button.propTypes = {
  onClick: PropTypes.func,
};
export default Button;

score:0

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
<div id="root" />

Related Query

More Query from same tag