React modules in react code example
Example 1: react modules
import React, { Component } from 'react';class Button extends Component { render() { // ... }}export default Button; // Don’t forget to use export default!Copy
Example 2: react modules
import React, { Component } from 'react';import Button from './Button'; // Import a component from another fileclass DangerButton extends Component { render() { return <Button color="red" />; }}export default DangerButton;Copy