
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
redux-wpapi
Advanced tools
A node-wpapi integration for a Redux based Application.
This library exposes node-wpapi instance through the actionCreator callAPI. The resulting action is interpreted in the middleware, doing so by resolving the request and controlling the reducer through actions.
npm install --save redux-wpapi
Then, to enable ReduxWPAPI, use applyMiddleware()
and combineReducers()
:
import reducers from './reducers';
import ReduxWPAPI from 'redux-wpapi';
const { reducer: wp, middleware } = new ReduxWPAPI({ /* … */ });
const store = createStore(
// the reducer must be placed at the root of the state as `wp`
// so the selector knows where state lives in
{ ...reducers, wp },
applyMiddleware(middleware)
);
import React from 'react';
import { wp, selectRequest, ResponseStatus } from 'redux-wpapi';
import { connect } from 'react-redux';
export class HomePage extends React.Component {
static loadData(props) {
return props.callAPI(
// The name where the request state will be placed
'HomePagePosts',
// A callback where wpapi instance is injected
api =>
api.posts()
.page(props.page)
.perPage(props.perPage)
);
}
componentWillMount() {
HomePage.loadData(this.props);
}
componentWillReceiveProps(props) {
HomePage.loadData(props);
}
render() {
const { status, data: posts } = this.props.request;
if (!posts) {
switch (status) {
case ResponseStatus.pending: return <div>Loading…</div>;
case ResponseStatus.rejected: return <div>An error has occurred</div>;
}
}
return (
<div>
{!posts.length ? <NoPostFound /> : <PostList posts={posts} />}
</div>
);
}
}
export default connect({
request: selectRequest('HomePagePosts'),
}, { callAPI })(HomePage);
All contributions are welcome, and very much appreciated.
We are preparing some helper documents to facilitate the process (hopefully), but for now we're following the these guidelines:
Every Pull Request must have the following:
FAQs
Wordpress integration Redux middleware based on node-wpapi.
The npm package redux-wpapi receives a total of 22 weekly downloads. As such, redux-wpapi popularity was classified as not popular.
We found that redux-wpapi demonstrated a not healthy version release cadence and project activity because the last version was released 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.