element-web-Github/test/components/stub-component.js

21 lines
452 B
JavaScript
Raw Normal View History

/* A dummy React component which we use for stubbing out app-level components
*/
import React from 'react';
2021-06-29 20:11:58 +08:00
export default function({ displayName = "StubComponent", render } = {}) {
2020-08-29 19:14:16 +08:00
if (!render) {
render = function() {
2020-08-29 20:02:45 +08:00
return <div>{ displayName }</div>;
};
}
2020-08-29 19:14:16 +08:00
return class extends React.Component {
static displayName = displayName;
render() {
return render();
}
};
2020-01-14 04:28:33 +08:00
}