
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@pagedotapp/page-db-write
Advanced tools
Database write component with Relay GraphQL mutation support
Database write component with Relay GraphQL mutation support
npm install @pagedotapp/page-db-write
import { PageDbWrite } from "@pagedotapp/page-db-write"
function App() {
return (
<PageDbWrite
onSuccess={(record) => console.log("Added:", record)}
onError={(error) => console.error("Failed:", error)}
/>
)
}
Prop | Type | Default | Description |
---|---|---|---|
className | string | '' | Additional CSS class name |
onSuccess | (record: any) => void | - | Callback when write is successful |
onError | (error: Error) => void | - | Callback when write fails |
The component uses the following GraphQL mutation (exported as PageDbWriteMutation
):
mutation PageDbWriteMutation($input: demoInsertInput!) {
insertIntodemoCollection(objects: [$input]) {
affectedCount
records {
id
created_at
text
}
}
}
For use in your app, ensure you have Relay configured and copy the mutation to your local queries:
// src/queries/PageDbWriteMutation.ts
import { graphql } from "react-relay"
export const PageDbWriteMutation = graphql`
mutation PageDbWriteMutation($input: demoInsertInput!) {
insertIntodemoCollection(objects: [$input]) {
affectedCount
records {
id
created_at
text
}
}
}
`
<PageDbWrite />
<PageDbWrite
onSuccess={(record) => {
toast.success(`Record ${record.id} added successfully!`)
}}
/>
<PageDbWrite
onError={(error) => {
toast.error(`Failed to add record: ${error.message}`)
}}
/>
<PageDbWrite className="my-custom-db-write" />
The component uses CSS modules for styling. You can override styles by passing a custom className
or by targeting the component's CSS classes:
.dbWrite
- Main container.form
- Form element.inputGroup
- Input and button container.input
- Text input field.button
- Submit buttonMIT © PageStudio
FAQs
Database write component with Relay GraphQL mutation support
We found that @pagedotapp/page-db-write demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.