19 lines
401 B
JavaScript
19 lines
401 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
/* the simplest way to define a component is to write a JavaScript function */
|
|
/* Accept a single property object argument */
|
|
function Loading(props) {
|
|
if (props.loading) {
|
|
/* return a React element */
|
|
return <p>Loading...</p>;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
Loading.propTypes = {
|
|
loading: PropTypes.bool,
|
|
};
|
|
|
|
export default Loading;
|