Skip to main content
Glama
expo.md2.32 kB
--- title: Expo description: Set of common methods and types for Expo and related packages. sourceCodeUrl: https://github.com/expo/expo/tree/sdk-52/packages/expo packageName: expo iconUrl: /static/images/packages/expo.png platforms: ["android", "ios", "tvos", "web"] isNew: true --- ## Installation ## API ```tsx ``` ### `expo/fetch` API `expo/fetch` provides a [WinterCG-compliant Fetch API](https://fetch.spec.wintercg.org/) that works consistently across web and mobile environments, ensuring a standardized and cross-platform fetch experience within Expo applications. ```ts Streaming fetch const resp = await fetch('https://httpbin.org/drip?numbytes=512&duration=2', { headers: { Accept: 'text/event-stream' }, }); const reader = resp.body.getReader(); const chunks = []; while (true) { const { done, value } = await reader.read(); if (done) { break; } chunks.push(value); } const buffer = new Uint8Array(chunks.reduce((acc, chunk) => acc + chunk.length, 0)); console.log(buffer.length); // 512 ``` ## Common questions ### What if I want to name my main app file something other than App.js or app/\_layout.tsx? **For projects that do not use [Expo Router](/router/introduction/)**, you can set the `"main"` in **package.json** to any file within your project. If you do this, then you need to use `registerRootComponent`. The `export default` will not make this component the root for the app if you are using a custom entry file. For example, let's say you want to make **src/main.jsx** the entry file for your app — maybe you don't like having JavaScript files in the project root. First, set this in **package.json**: ```json package.json { "main": "src/main.jsx" } ``` Then, in **src/main.jsx**, make sure you call `registerRootComponent` and pass in the component you want to render at the root of the app: ```jsx src/main.jsx function App() { return ; } registerRootComponent(App); ``` **For projects that use [Expo Router](/router/introduction/)**, you can create a custom entry point by following these steps from [Expo Router's installation guide](/router/installation/#custom-entry-point-to-initialize-and-load). To use the top-level **src** directory in your Expo Router project, see [src directory reference](/router/reference/src-directory/) for more information.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jaksm/expo-docs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server