Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@contember/react-client

Package Overview
Dependencies
Maintainers
5
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contember/react-client - npm Package Compare versions

Comparing version 1.0.0-rc.23 to 1.0.0-rc.24

8

package.json
{
"name": "@contember/react-client",
"license": "Apache-2.0",
"version": "1.0.0-rc.23",
"version": "1.0.0-rc.24",
"type": "module",

@@ -22,3 +22,3 @@ "sideEffects": false,

"dependencies": {
"@contember/client": "1.0.0-rc.23"
"@contember/client": "1.0.0-rc.24"
},

@@ -29,5 +29,7 @@ "peerDependencies": {

"scripts": {
"build": "vite build --mode development && vite build --mode production"
"build": "pnpm run build:js:dev && pnpm run build:js:prod",
"build:js:dev": "vite build --mode development",
"build:js:prod": "vite build --mode production"
},
"readme": "# `@contember/react-client`\n\n## Usage\n\nIf you wish to communicate with any Contember API, wrap your code with the `ContemberClient` component:\n\n```tsx\nimport { ContemberClient } from '@contember/react-client'\n\n<ContemberClient\n\tapiBaseUrl=\"https://api.example.com\"\n\tproject=\"PROJECT-SLUG\"\n\tsessionToken=\"SESSION-TOKEN\"\n\tstage=\"STAGE-SLUG\"\n>\n\t...\n</ContemberClient>\n```\n\n## Notable APIs\n\nYou'll have to look at the code for now, sorry.\n\n- `<RichTextRenderer />`\n- `useFileUpload`\n- `useContentApiRequest` / `useTenantApiRequest` / `useSystemApiRequest`\n\n## RichTextRenderer\n\nHere is simple exmaple of how to use the `RichTextRenderer` component with custom references and elements.\n\n```tsx\nimport { RichTextRenderer } from '@contember/react-client'\nimport Image from './myComponents/Image'\nimport Gallery from './myComponents/Gallery'\nimport Quote from './myComponents/Quote'\nimport Link from './myComponents/Link'\n\n<RichTextRenderer\n\tsourceField=\"json\"\n\trenderElement={(props) => {\n\t\tif (props.element.type === 'link' && props.reference) {\n\t\t\treturn <Link label={props.element.children[0].text} url={props.reference.target} />\n\t\t}\n\n\t\treturn props.fallback\n\t}}\n\treferenceRenderers={{\n\t\timage: (reference) => <Image reference={reference} />,\n\t\tgallery: (reference) => <Gallery reference={reference} />,\n\t\tquote: (reference) => <Quote reference={reference} />,\n\t}}\n/>\n```\n\n| Prop | Description |\n| -------------------- | ----------------------------------------------------- |\n| `sourceField` | The field in the GraphQL that contains the rich text. |\n| `renderElement` | Function that renders an element. |\n| `referenceRenderers` | Object that maps reference types to renderers. |\n"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc