You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have already created the chunk you would like to render on the Editmode CMS, you can simply pass the identifier as a prop and begin editing.
37
-
You can also provide default content as a fallback should anything go wrong trying to retrieve the data from the API:
37
+
You can provide default content as a fallback should anything go wrong trying to retrieve the data from the API:
38
38
39
39
```
40
40
import { Chunk } from "editmode-react";
41
41
42
42
function Example() {
43
43
return (
44
44
<div>
45
-
<p>
46
-
<Chunk identifier="cnk_123"/>
47
-
</p>
48
-
<p>
49
-
<Chunk identifier="cnk_321">
50
-
I have default content
51
-
</Chunk>
52
-
</p>
53
-
</div>
45
+
<p>
46
+
<Chunk identifier="cnk_123"/>
47
+
</p>
48
+
<p>
49
+
<Chunk identifier="cnk_321">
50
+
I have default content
51
+
</Chunk>
52
+
</p>
53
+
</div>
54
54
);
55
55
}
56
56
```
57
57
58
-
Alternatively, if you are using one of our **text editor plugins** and would like to create a new chunk directly from the editor, you may select the piece of text you would like to convert and hit CMD+SHIFT+L. (For Visual Studio Code users, you can also hit CMD+SHIFT+P to open the command pallete, type "Editmode: Create Chunk" and hit enter).
58
+
Alternatively, if you are using one of our **text editor plugins** and would like to create a new chunk directly from the editor, you may select the piece of text you would like to convert and hit CMD+SHIFT+L. (For Visual Studio Code users, you can also hit CMD+SHIFT+P to open the command palette, type "Editmode: Create Chunk" and hit enter).
59
59
60
60
#### Rendering a chunk collection:
61
61
62
-
TBC
62
+
Chunk collections are simply a way to categorise chunks and can be used to render repeatable content.
63
+
Each collection can contain many properties and each property can hold different types of information.
64
+
65
+
A good use case example would be creating a "Team Member" collection. It may have `Full Name`, `Title` and `Headshot` properties. Within your React app, you may want to display the name, title and headshot of all your team members (ie all chunks within the Team Member collection). You can do this by passing the chunk collection identifier as a prop to the ChunkCollection component. To render the name, title and headshot for each team member, pass the identifiers for each property as a prop to the ChunkProperty component:
66
+
67
+
```
68
+
import { ChunkCollection, ChunkProperty } from "editmode-react";
This will render editable headings containing the name and title and an image containing the headshot for every person in the "Team Member" collection.
63
83
64
84
### Step 3:
65
85
66
-
You can now edit all of the chunks in your React app from within the browser - just add `editmode=1` as a query string parameter to the current URL.
86
+
You can now edit and save all of the chunks in your React app from within the browser - just add `editmode=1` as a query string parameter to the current URL.
0 commit comments