{data.map(({ _id, text }) => (
{text}
))}
);
}
```
--------------------------------
### Deploy Application to Convex Production
Source: https://docs.convex.dev/understanding/workflow
This command pushes your code to your project's production deployment on Convex. If it's the first time running this command for a project, it will automatically provision the production deployment environment.
```bash
npx convex deploy
```
--------------------------------
### Create React Native App
Source: https://docs.convex.dev/quickstart/react-native
Command to create a new React Native application using Expo CLI. This sets up the basic project structure for a React Native app.
```bash
npx create-expo-app my-app
```
--------------------------------
### Run Python Main Script
Source: https://docs.convex.dev/quickstart/python
Executes the Python script named 'main.py' using the Python interpreter from the virtual environment. This will fetch and display data from your Convex database.
```bash
venv/bin/python -m main
```
--------------------------------
### Server-Side Rendering with useSuspenseQuery
Source: https://docs.convex.dev/client/tanstack/tanstack-start
Demonstrates server-side rendering of Convex queries using `useSuspenseQuery` from React Query in TanStack Start. This ensures consistent data views during SSR and client-side navigation.
```typescript
const { data } = useSuspenseQuery(convexQuery(api.messages.list, {}));
```
--------------------------------
### Calling Queries from Clients (React Example)
Source: https://docs.convex.dev/understanding/convex-fundamentals/functions
This endpoint demonstrates how to call a query from a React component using the `useQuery` hook and the generated `api` object.
```APIDOC
## React Client Query Call
### Description
Shows how to call a query from a React component using the `useQuery` hook.
### Method
N/A (React component usage)
### Endpoint
N/A
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
{
"a": 1,
"b": 2
}
### Response
#### Success Response (200)
- **data** (any) - The result of the query.
#### Response Example
{
"data": 3
}
```
--------------------------------
### Install Sharded Counter Component
Source: https://docs.convex.dev/components/using-components
Installs the Sharded Counter component from npm. This is the first step in integrating a new component into your Convex application.
```bash
npm i @convex-dev/sharded-counter
```
--------------------------------
### Example: Rate Limiter Component Usage
Source: https://docs.convex.dev/components/using-components
Demonstrates how to use the `limit` API of the Rate Limiter component, with an option to throw an error if the rate limit is hit. This example highlights transaction rollback behavior.
```typescript
// Automatically throw an error if the rate limit is hit.
await rateLimiter.limit(ctx, "failedLogins", { key: userId, throws: true });
```
--------------------------------
### Example .env.local File for Frontend Environment Variables
Source: https://docs.convex.dev/client/react/deployment-urls
This example .env.local file illustrates how to set frontend-accessible environment variables, including the Convex deployment URL (NEXT_PUBLIC_CONVEX_URL) and other service keys like Sentry DSN and LaunchDarkly SDK ID. These variables are typically used by bundlers to inject values into the client-side code.
```dotenv
NEXT_PUBLIC_CONVEX_URL=https://guiltless-dog-960.convex.cloud
# examples of other environment variables that might be passed to the frontend
NEXT_PUBLIC_SENTRY_DSN=https://123abc@o123.ingest.sentry.io/1234
NEXT_PUBLIC_LAUNCHDARKLY_SDK_CLIENT_SIDE_ID=01234567890abcdef
```
--------------------------------
### Push Config Audit Log JSON Example
Source: https://docs.convex.dev/production/integrations/log-streams/legacy-event-schema
This example demonstrates the JSON structure of an audit log entry for the 'push_config' action, including fields for topic, timestamp, action, and actionMetadata with added/removed modules. It is output from Convex's auditing system and serves as a reference for log parsing; actual entries may differ based on deployment details.
```json
{
"_topic": "_audit_log",
"_timestamp": 1695066350531,
"action": "push_config",
"actionMetadata": {
"modules": {
"added": ["ffmpeg.js", "fetch.js", "test.js"],
"removed": ["removed.js"]
}
}
}
```
--------------------------------
### Loader for Preloading Data in TanStack Start
Source: https://docs.convex.dev/client/tanstack/tanstack-start
Illustrates how to use loaders in TanStack Start to preload data for a route using React Query's `ensureQueryData`. This improves client-side navigation performance by fetching data proactively.
```typescript
export const Route = createFileRoute('/posts')({
loader: async (opts) => {
await opts.context.queryClient.ensureQueryData(
convexQuery(api.messages.list, {}),
);
};
component: () => {
const { data } = useSuspenseQuery(convexQuery(api.messages.list, {}));
return (