How to Use Syncfusion’s React Rich Text Editor with React Redux Form | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (179).NET Core  (28).NET MAUI  (214)Angular  (110)ASP.NET  (51)ASP.NET Core  (83)ASP.NET MVC  (90)Azure  (41)Black Friday Deal  (1)Blazor  (226)BoldSign  (15)DocIO  (24)Essential JS 2  (109)Essential Studio  (200)File Formats  (69)Flutter  (133)JavaScript  (226)Microsoft  (120)PDF  (81)Python  (1)React  (105)Streamlit  (1)Succinctly series  (131)Syncfusion  (943)TypeScript  (33)Uno Platform  (3)UWP  (3)Vue  (45)Webinar  (52)Windows Forms  (61)WinUI  (71)WPF  (163)Xamarin  (160)XlsIO  (38)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (9)Business intelligence  (55)Button  (4)C#  (158)Chart  (140)Chart of the week  (54)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (70)Development  (659)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (14)Excel  (43)Extensions  (23)File Manager  (7)Gantt  (19)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (512)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (54)Security  (4)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (14)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (113)UI  (393)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (615)What's new  (333)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
How to Use Syncfusion’s React Rich Text Editor with React Redux Form

How to Use Syncfusion’s React Rich Text Editor with React Redux Form

The Syncfusion React Rich Text Editor component is a WYSIWYG editor component that can be used to frame a UI form control. It works seamlessly with React Redux Form and can validate inputs in form fields.

This blog explains the procedure to merge our Rich Text Editor component with Redux Form fields to validate inputs. The following topics are covered in this blog:

What is Redux Form?

Redux is an open-source JavaScript library. It is used to develop UI components in React and Angular platforms. redux -form is a validation library that can be integrated into any React web application easily. It uses the Redux library to store field input values and higher-order components.

Refer to the redux-form documentation page to get more information.

Now, let’s see how to create a React app with Redux and integrate our React Rich Text Editor within it.

Getting started with create-react-app

To create a React application, follow these steps:

Step 1: Use the create-react-app command to install the NuGet package globally that we will use to create a basic React application.

npm i create-react-app -g

You can create the app in any directory by using the create-react-app command.

Step 2: Move to the directory where you want to create the application and run the following command. Here, I am naming this app RichTextEditor-Redux-Form.

create-react-app RichTextEditor-Redux-Form

Thus, we have created the application.

Step 3: To run the application with default configuration, move to the application’s directory and use the following command.

cd RichTextEditor-Redux-Form
npm start

The React application

With this, we have created the base application and made it run.

Configuring the Syncfusion React Rich Text Editor component

Run the following command to install the NuGet package needed to configure the React application with the Syncfusion React Rich Text Editor.

npm install ej2-react-richtexteditor

The following command will install Redux and its dependent packages along with redux-form to validate inputs with a custom React component.

npm i --save-dev redux react-redux redux-form

Now, we have completed the required configuration.

Create a Redux store

Create a store with combineReducers and pass it through the Provider component in the index.js file. Refer to the following code example.

// index.js
import React from 'react';
import ReactDOM from 'react-dom';
import { createStore, combineReducers } from 'redux';
import { Provider } from 'react-redux';
import { reducer as formReducer } from 'redux-form';
import App from './App';

const rootReducer = combineReducers({
    form: formReducer

const store = createStore(rootReducer);

<Provider store={store}>
 <App />

Create an RteForm.js file

After creating the Redux store, create an RteForm.js file inside the src directory and merge the Rich Text Editor component within the Field input to communicate with the redux store and pass it with reduxForm.

RteForm will provide the Redux Form states and functions to handle the submission process and show the validation message in a label.

To validate the Rich Text Editor component within Redux Form, map the following field input event handlers to the events of the Rich Text Editor.

RichTextEditor EventsField Input

Refer to the following code.

import React from ‘react’;
import { Field, reduxForm } from ‘redux-form’;
import { HtmlEditor, Image, Inject, Link, QuickToolbar, RichTextEditorComponent, Toolbar } from ‘@syncfusion/ej2-react-richtexteditor’;

const validate = values => {
  const errors = {}
  if (values.comment && values.comment.length < 20) {
    errors.comment = ‘Minimum be 20 characters or more’;
  } else if (!values.comment) {
    errors.comment = ‘Required’;
  } else {
    errors.comment = false;
  return errors

const renderRTEField = ({ input, label, type, meta: { touched, error, warning } }) => (
    <label className=”control-label”>{label}</label>
      <RichTextEditorComponent htmlAttributes={{ name: “comment” }} value={input.value}
        change={param => input.onChange(param.value)} focus={param => input.onFocus()} blur={param => input.onBlur()} id=”defaultRTE”>
        <Inject services={[HtmlEditor, Toolbar, Image, Link, QuickToolbar]} />
      {touched && ((error && <span className=”text-danger”>{error}</span>) || (warning && <span>{warning}</span>))}

let RteForm = props => {
  const { handleSubmit, pristine, submitting } = props;
  return (
    <form onSubmit={handleSubmit}>
      <div className=”form-group”>
        <Field name=”comment” component={renderRTEField} label=”Comment” />
      <div className=”form-group”>
        <button type=”submit” disabled={pristine || submitting} className=”btn btn-primary”>Submit</button>
RteForm = reduxForm({
  form: ‘contact’,

export default RteForm;

Now, the RteForm.js file will act as a React web form component with a Redux Form field. The validation in this form field will be done by the Rich Text Editor component.

Integrate the Rich Text Editor form into a React component

Refer to the following code to integrate the Rich Text Editor form into a React component.

import React from 'react';
import RteForm from './RteForm';

class App extends React.Component {
  submit = (values) => {
    alert("Form values submitted");
  render() {
    return (
      <div className="container">
        <h3>Redux Form Validation with RichTextEditor</h3>
        <RteForm onSubmit={this.submit} />

export default App;

Now, the Rich Text Editor component is ready to use in the Redux Form with validation. I am going to run the application and then switch to the browser to see the Rich Text Editor component inside the form.

In the application, enter a value in the form field and click on the Submit button. The value will be validated by the Rich Text Editor and will show you the validation message if the entered value is fewer than 20 characters.
Redux Form validation with RichTextEditor in the browser console


You can check out the complete project from this GitHub repository.


I hope you now have a clear idea of how to add the Syncfusion React Rich Text Editor component inside a Redux Form for validation. We look forward to you trying out this integration and hope you provide feedback in the comments section below.

If you are new to Syncfusion, try our control’s features by downloading a free trial. You can also explore our online demo and our documentation.

You can contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed