How to import the Syncfusion ReactJS components using webpack?
To import the dependent scripts for the specific ReactJS component into the JSX file. Follow the below steps to configure the Syncfusion React components.
1) Create a new application with React using the following link:
https://help.syncfusion.com/reactjs/overview#getting-started-with react
2) Open the command prompt and navigate to the application root folder then install webpack, react by using the below commands.
$ npm install --save-dev webpack $ npm install react $ npm install react-dom $ npm install --save-dev babel-preset-es2015 $ npm install babel-loader babel-core babel-preset-env webpack --save-dev
3)Configure the Syncfusion JavaScript components through npm https://help.syncfusion.com/js/installation-and-deployment. This will fetch Syncfusion dependent files through node.
4)Import the dependent scripts in JSX file as like as below:
import React from 'react'; import ReactDOM from 'react-dom'; import 'syncfusion-javascript/Scripts/ej/web/ej.rte.min' import 'syncfusion-javascript/Scripts/ej/common/ej.web.react.min' class Sample extends React.Component { render() { return <EJ.RTE id="rteDef"></EJ.RTE> } } ReactDOM.render(<Sample/>, document.getElementById('autocomplete-default'));
5)Compile the application and run the demo to render the Syncfusion React components by using the below command,
$ webpack
Refer to the following sample:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/webpack.config-1368596260.zip
Conclusion
I hope you enjoyed learning how to import the Syncfusion ReactJS components using webpack.
You can refer to our JavaScript feature tour page to know about its other groundbreaking feature representations documentation and how to quickly get started for configuration specifications. You can also explore our JavaScript example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!