
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-cms-components
Advanced tools
A light framework for integrating React with any CMS using the DOM as the hook.
A light framework for integrating React with any CMS using the DOM as the hook. Choose whether imports are lazy loaded or static.
yarn add react-cms-components
or
npm install --save react-cms-components
import ReactCMSComp from './react-cms-components';
// Manually import this one since we want it on every page (for example)
import SomeComponent from '../components/somecomponent';
// Returns an array of objects, parsed by ReactCMSComp, from all DOM nodes with `data-component`
const componentArray = ReactCMSComp.return({
componentList: document.querySelectorAll('[data-component]')
});
// Create an object that maps the component names in `componentArray` to any staticly imported ones.
const staticComponentMap = {
'some-component': SomeComponent
}
//Loop the componentArray to render to the page
if (componentArray.length > 0) {
componentArray.map(component => {
if (component.dynamic === true) {
// Chunks are numbered rather than named
import(`../../components/content'/${component.name}/js`).then(module => render(<module.default {...component.props} />, component.element));
} else {
const Comp = staticComponentMap[component.name];
render(<Comp {...component.props} />, component.element);
}
})
}
And then in your page's markup:
<section>
<div data-component="SomeComponent" data-prop-title="Title" data-prop-tag="h1"></div>
<div data-component="SomeOtherComponentName" data-props='{"title": "Fabulous"}'></div>
</section>
To make a component 'dynamic' (lazy loaded) simply add data-dynamic to the tag.
<div data-component="SomeOtherComponentName" data-props='{"title": "Fabulous"}' data-dynamic></div>
FAQs
A light framework for integrating React with any CMS using the DOM as the hook.
We found that react-cms-components demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.