Skip to content

Component API

The most basic way to use Fabrix is to use the component API.

FabrixComponent

Give your own query to query prop to render components with fabrix.

import { FabrixComponent } from "@fabrix-framework/fabrix"
const Characters = () => {
return (
<FabrixComponent
query={`
#
# GraphQL queries...
#
`}
/>
)
}

Query

import { FabrixComponent } from "@fabrix-framework/fabrix"
const Characters = () => {
return (
<FabrixComponent
query={`
query characters {
characters {
collection {
id
name
status
}
}
}
`}
/>
)
}

Mutation

import { FabrixComponent } from "@fabrix-framework/fabrix";
const CreateCharacter = () => {
return (
<FabrixComponent
mutation={`
mutation createCharacter($input: CreateCharacterInput!) {
createCharacter(input: $input) {
id
}
}
`}
/>
);
}