From 699da23ced6f70d7e4dd35a9637d8351567d9e09 Mon Sep 17 00:00:00 2001 From: Sean Matheson Date: Sun, 17 Jul 2016 22:02:46 +0100 Subject: [PATCH] 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. --- docs/guides/installing-slate.md | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/docs/guides/installing-slate.md b/docs/guides/installing-slate.md index 55703bd84..28d07dbd4 100644 --- a/docs/guides/installing-slate.md +++ b/docs/guides/installing-slate.md @@ -31,22 +31,20 @@ To keep things simple, we'll use the `Raw` serializer that ships with Slate to c import { Editor, Raw } from 'slate' // Create our initial state... -const initialState = Raw.deserialize([ - { - kind: 'block', - type: 'paragraph', - nodes: [ - { - kind: 'text', - ranges: [ - { - text: 'A line of text in a paragraph.' - } - ] - } - ] - } -]) +const initialState = Raw.deserialize({ + kind: 'block', + type: 'paragraph', + nodes: [ + { + kind: 'text', + ranges: [ + { + text: 'A line of text in a paragraph.' + } + ] + } + ] +}) ``` And now that we've our initial state, we define our `App` and pass it into Slate's `Editor` component, like so: