1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-16 20:24:01 +02:00

Fix "initialState" declaration in "Installing Slate" doc (#105)

I tried to use the example however I received errors saying that `map` could not be executed over `undefined`.

It looks like the deserialiser was trying to map over the `nodes` prop of an object, but the example passes in an array of objects.  I removed the wrapping array and all was well again.
This commit is contained in:
Sean Matheson
2016-07-17 22:02:46 +01:00
committed by Ian Storm Taylor
parent b5880e607f
commit 699da23ced

View File

@@ -31,8 +31,7 @@ To keep things simple, we'll use the `Raw` serializer that ships with Slate to c
import { Editor, Raw } from 'slate' import { Editor, Raw } from 'slate'
// Create our initial state... // Create our initial state...
const initialState = Raw.deserialize([ const initialState = Raw.deserialize({
{
kind: 'block', kind: 'block',
type: 'paragraph', type: 'paragraph',
nodes: [ nodes: [
@@ -45,8 +44,7 @@ const initialState = Raw.deserialize([
] ]
} }
] ]
} })
])
``` ```
And now that we've our initial state, we define our `App` and pass it into Slate's `Editor` component, like so: And now that we've our initial state, we define our `App` and pass it into Slate's `Editor` component, like so: