Skip to main content
Version: 2.x

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 1 or above (which can be checked by running node -v).

Setup​

When cloning the main project, wp-react-lib comes as a submodule and can be found in the front/react-lib/wp-react-lib directory inside the front submodule.

Steps​

  1. Follow WordPress setup wizard
  2. Go to settings -> permalinks, then choose day and name
  3. This configuration depends of your react routes setup
  4. Go to appearance -> themes and activate wp-react-theme
  5. By activating this theme WordPress will disable its front-end
  6. Go to plugins and activate the following plugins
    • WP Multilang
    • WP-REST-API V2 Menus
    • WP React Lib Components