Create a DataSourceWrapper to determine correct data source and provide data to layout component
This commit is contained in:
1 parent
068939b70f
commit
3238edddd2
2 files changed
+44
-3
No files matched your search
@@ -0,0 +1,32 @@
|
||||
/* eslint-disable react/jsx-props-no-spreading */
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
//
|
||||
import { extensionManager } from '../App.js';
|
||||
|
||||
/**
|
||||
* Uses route properties to determine the data source that should be passed
|
||||
* to the child layout template. In some instances, initiates requests and
|
||||
* passes data as props.
|
||||
*
|
||||
* @param {object} props
|
||||
* @param {function} props.children - Layout Template React Component
|
||||
*/
|
||||
function DataSourceWrapper(props) {
|
||||
const { children: LayoutTemplate, ...rest } = props;
|
||||
console.log('data source wrapper', props);
|
||||
console.log(extensionManager);
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<LayoutTemplate {...rest} />
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
DataSourceWrapper.propTypes = {
|
||||
/** Layout Component to wrap with a Data Source */
|
||||
children: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired,
|
||||
};
|
||||
|
||||
export default DataSourceWrapper;
|
||||
Reference in new issue
Block a user