mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-31 19:01:54 +02:00
GitBook: [main] 58 pages and 7 assets modified
This commit is contained in:
committed by
gitbook-bot
parent
15966086d4
commit
a38957b849
@@ -2,17 +2,17 @@
|
||||
|
||||
Slate is a monorepo divided up into multiple npm packages, so to install it you do:
|
||||
|
||||
```
|
||||
```text
|
||||
yarn add slate slate-react
|
||||
```
|
||||
|
||||
You'll also need to be sure to install Slate's peer dependencies:
|
||||
|
||||
```
|
||||
```text
|
||||
yarn add react react-dom
|
||||
```
|
||||
|
||||
_Note, if you'd rather use a pre-bundled version of Slate, you can `yarn add slate` and retrieve the bundled `dist/slate.js` file! Check out the [Using the Bundled Source](./XX-using-the-bundled-source.md) guide for more information._
|
||||
_Note, if you'd rather use a pre-bundled version of Slate, you can `yarn add slate` and retrieve the bundled `dist/slate.js` file! Check out the_ [_Using the Bundled Source_](xx-using-the-bundled-source.md) _guide for more information._
|
||||
|
||||
Once you've installed Slate, you'll need to import it.
|
||||
|
||||
@@ -47,9 +47,9 @@ const App = () => {
|
||||
|
||||
Of course we haven't rendered anything, so you won't see any changes.
|
||||
|
||||
> If you are using TypeScript, you will also need to extend the `Editor` with `ReactEditor` as per the documentation on [TypeScript](/concepts/11-typescript). The example below also includes the custom types required for the rest of this example.
|
||||
> If you are using TypeScript, you will also need to extend the `Editor` with `ReactEditor` as per the documentation on [TypeScript](https://github.com/ianstormtaylor/slate/tree/4b92b752ef234dae57149c713a260b7bacb3f810/concepts/11-typescript/README.md). The example below also includes the custom types required for the rest of this example.
|
||||
|
||||
```ts
|
||||
```typescript
|
||||
// TypeScript Users only add this code
|
||||
import { BaseEditor } from 'slate'
|
||||
import { ReactEditor } from 'slate-react'
|
||||
@@ -154,3 +154,4 @@ const App = () => {
|
||||
There you have it!
|
||||
|
||||
That's the most basic example of Slate. If you render that onto the page, you should see a paragraph with the text `A line of text in a paragraph.` And when you type, you should see the text change!
|
||||
|
||||
|
Reference in New Issue
Block a user