
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
@devgateway/wp-react-lib
Advanced tools
An easy way to integrate your react application with the world's **most popular** content management system. **wp-react-lib** uses the [Wordpress REST API](https://developer.wordpress.org/rest-api/) to load content into your classic React.js stack, it als
An easy way to integrate your react application with the world's most popular content management system. wp-react-lib uses the Wordpress REST API to load content into your classic React.js stack, it also allows embedding your own React.js components within pages and posts.
Run npm install to install all dependencies and npm run dist to build the library.
wp-react-lib@0.1.0 uses Redux and Immutable , you need to configure your store as the following example:
import {applyMiddleware, compose, createStore} from 'redux'
import {combineReducers} from 'redux-immutable';
import {Map} from 'immutable'
import thunk from 'redux-thunk'
import {wordpress} from "wp-react-lib";
const initialState = Map()
const getRootReducer = () => combineReducers({
wordpress,
})
const store = createStore(
getRootReducer(), // root reducer with router state
initialState,
compose(applyMiddleware(thunk))
)
<Provider store={store}>
<div className="App">
<PageProvider slug={"home"}>
<PageConsumer>
<Page/>
</PageConsumer>
</PageProvider>
</div>
</Provider>
<Provider store={store}>
<div className="App">
<PostProvider slug={"my-post-slug"}>
<PostConsumer>
<Post/>
</PostConsumer>
</PostProvider>
</div>
</Provider>
const List = ({posts}) => {
return
<ul>
{posts.map(post =>(<li> <h1 dangerouslySetInnerHTML={{__html: post.title.rendered}}/> </li>))}
</ul>
}
function ShowPosts() {
return (
<Provider store={store}>
<div className="App">
<PostProvider>
<PostConsumer>
<List></List>
</PostConsumer>
</PostProvider>
</div>
</Provider> );
}
Using router for loading pages
<Route exact path="/:slug" render={(props)=>{
return (<div className="App">
<PageProvider slug={props.match.params.slug}>
<PageConsumer>
<Page></Page>
</PageConsumer>
</PageProvider>
</div>
}}>
</Route>
Using router for loading posts
<Route path="/:lan/:year/:month/:day/:slug/" exact render=
{props => (
<PostProvider slug={props.match.params.slug} >
<PostConsumer>
<Post></Post>
</PostConsumer>
</PostProvider>
)}>
</Route>
You can create and embed your own React components in WordPress editor, configure them, save its metadata, and render them in your React UI as part of your react application.
To create an embeddable component you need
Please look at wp-react-example-advanced and wp-react-blocks-plugin
For details about how to send pull requests, please read CONTRIBUTING.md.
The list of all contributors to this project can be read at contributors.
This project is under - Apache License 2.0 - for more details please check Apache License 2.0
FAQs
An easy way to integrate your react application with the world's **most popular** content management system. **wp-react-lib** uses the [Wordpress REST API](https://developer.wordpress.org/rest-api/) to load content into your classic React.js stack, it als
We found that @devgateway/wp-react-lib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.