WP React Lib - Getting Started
This Library facilitates the seamless integration of your React application with the globally renowned content management system, WordPress.
wp-react-lib employs the WordPress REST API to dynamically load content into your traditional React.js framework.
Furthermore, it enables the embedding of custom React.js components within pages and posts.
Key Features​
- WordPress REST API Integration: Seamlessly fetches content from WordPress using its REST API
- React Component Support: Allows embedding React components within WordPress content
- React Compiler: Includes a compiler to auto optimize React components for WordPress integration
- Content Loading: Provides components for loading pages, posts and other WordPress content
- State Management: Built-in state management with Redux for WordPress data
Project Repository: wp-react-lib
Prerequisites​
- Node.js version 22 or above (which can be checked by running
node -v).
Setup​
- Install the
wp-react-libpackage
- npm
- pnpm
- Yarn
- Bun
npm install @devgateway/wp-react-lib
pnpm add @devgateway/wp-react-lib
yarn add @devgateway/wp-react-lib
bun add @devgateway/wp-react-lib
Steps​
- Follow WordPress setup wizard
- Go to settings -> permalinks, then choose day and name
- This configuration depends of your react routes setup
- Go to appearance -> themes and activate
wp-react-theme - By activating this theme WordPress will disable its front-end
- Go to plugins and activate the following plugins
- WP Multilang
- WP-REST-API V2 Menus
- WP React Lib Components