|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: React Spreadsheet getting started with Preact | Syncfusion |
| 4 | +description: Provides a short overview for integrating and using the Syncfusion React Spreadsheet within Preact. |
| 5 | +control: Spreadsheet |
| 6 | +platform: document-processing |
| 7 | +documentation: ug |
| 8 | +--- |
| 9 | + |
| 10 | +# Getting started with Syncfusion React Spreadsheet in Preact |
| 11 | + |
| 12 | +This section helps you to quickly integrate the Syncfusion **React Spreadsheet** component into a [Preact](https://preactjs.com) application. |
| 13 | + |
| 14 | +[Preact](https://preactjs.com) is a lightweight alternative to React that provides a React‑compatible API through `preact/compat`, which enables Syncfusion React components to work seamlessly without additional configuration. |
| 15 | + |
| 16 | +This page focuses on the required setup: installing packages, adding styles, and rendering the Spreadsheet component. |
| 17 | + |
| 18 | +## Dependencies |
| 19 | + |
| 20 | +The following list of dependencies are required to use the Spreadsheet component in your application: |
| 21 | + |
| 22 | +```js |
| 23 | +|-- @syncfusion/ej2-react-spreadsheet |
| 24 | + |-- @syncfusion/ej2-react-base |
| 25 | + |-- @syncfusion/ej2-spreadsheet |
| 26 | + |-- @syncfusion/ej2-base |
| 27 | + |-- @syncfusion/ej2-dropdowns |
| 28 | + |-- @syncfusion/ej2-navigations |
| 29 | + |-- @syncfusion/ej2-grids |
| 30 | + |
| 31 | +``` |
| 32 | + |
| 33 | +## Setup |
| 34 | + |
| 35 | +Create a new Preact project and install the Syncfusion React Spreadsheet package. |
| 36 | + |
| 37 | +```bash |
| 38 | +npm init preact |
| 39 | +cd my-project |
| 40 | +npm install @syncfusion/ej2-react-spreadsheet --save |
| 41 | + |
| 42 | +# or using yarn: |
| 43 | +yarn init preact |
| 44 | +yarn add @syncfusion/ej2-react-spreadsheet |
| 45 | +``` |
| 46 | + |
| 47 | +## Adding CSS reference |
| 48 | + |
| 49 | +Add components style as given below in `src/styles.css`. |
| 50 | + |
| 51 | +```css |
| 52 | +@import '../node_modules/@syncfusion/ej2-base/styles/material.css'; |
| 53 | +@import '../node_modules/@syncfusion/ej2-inputs/styles/material.css'; |
| 54 | +@import '../node_modules/@syncfusion/ej2-buttons/styles/material.css'; |
| 55 | +@import '../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css'; |
| 56 | +@import '../node_modules/@syncfusion/ej2-lists/styles/material.css'; |
| 57 | +@import '../node_modules/@syncfusion/ej2-navigations/styles/material.css'; |
| 58 | +@import '../node_modules/@syncfusion/ej2-popups/styles/material.css'; |
| 59 | +@import '../node_modules/@syncfusion/ej2-dropdowns/styles/material.css'; |
| 60 | +@import '../node_modules/@syncfusion/ej2-grids/styles/material.css'; |
| 61 | +@import '../node_modules/@syncfusion/ej2-react-spreadsheet/styles/material.css'; |
| 62 | +``` |
| 63 | + |
| 64 | +## Adding Spreadsheet component |
| 65 | + |
| 66 | +Now, you can import the spreadsheet component into your `src/index.jsx` file. |
| 67 | + |
| 68 | +```js |
| 69 | +import { render } from 'preact'; |
| 70 | +import { SpreadsheetComponent } from '@syncfusion/ej2-react-spreadsheet'; |
| 71 | +import './style.css'; |
| 72 | + |
| 73 | +function App() { |
| 74 | + return ( |
| 75 | + <SpreadsheetComponent /> |
| 76 | + ); |
| 77 | +} |
| 78 | + |
| 79 | +render(<App />, document.getElementById('app')); |
| 80 | +``` |
| 81 | + |
| 82 | +## Run the application |
| 83 | + |
| 84 | +Now run the `npm run dev` command in the console to start the development server. This command compiles your code and serves the application locally, opening it in the browser. |
| 85 | + |
| 86 | +## See Also |
| 87 | + |
| 88 | +* [Getting started Syncfusion React Spreadsheet](https://help.syncfusion.com/document-processing/excel/spreadsheet/react/getting-started) |
0 commit comments