Skip to content

Commit 7c3440f

Browse files
authored
feat: export BlocksContent type (#13)
1 parent 3d3c0e0 commit 7c3440f

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ npm install @strapi/blocks-react-renderer react react-dom
1919
After fetching your Strapi content, you can use the BlocksRenderer component to render the data from a blocks attribute. Pass the array of blocks coming from your Strapi API to the `content` prop:
2020

2121
```jsx
22-
import { BlocksRenderer } from '@strapi/blocks-react-renderer';
22+
import { BlocksRenderer, type BlocksContent } from '@strapi/blocks-react-renderer';
2323

2424
// Content should come from your Strapi API
25-
const content = [
25+
const content: BlocksContent = [
2626
{
2727
type: 'paragraph',
2828
children: [{ type: 'text', text: 'A simple paragraph' }],

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
import { BlocksRenderer } from './BlocksRenderer';
22

3+
import type { RootNode } from './BlocksRenderer';
4+
5+
type BlocksContent = RootNode[];
6+
37
export { BlocksRenderer };
8+
export type { BlocksContent };

0 commit comments

Comments
 (0)