# Gestión de estado con Context (React / Next.js) > Context API, createContext, useContext, Provider pattern, context composition, performance - 18 preguntas de entrevista - Junior - [Preguntas de entrevista: React / Next.js](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista.md) ## 1. ¿Qué es el Context API en React? **Respuesta** Context API es un mecanismo integrado en React que permite compartir datos entre componentes sin pasar explícitamente las props por cada nivel. Resuelve el problema del prop drilling creando un estado global accesible para todos los componentes descendientes. Context es especialmente adecuado para datos que cambian poco, como el tema, el idioma o el usuario autenticado. ## 2. ¿Qué función se usa para crear un nuevo Context? **Respuesta** La función createContext es el método nativo de React para inicializar un nuevo contexto. Acepta un valor por defecto opcional que se usará si un componente consume el Context sin un Provider padre. Esta función retorna un objeto que contiene Provider y Consumer, aunque Consumer raramente se usa con los hooks modernos. ## 3. ¿Qué hook se usa para consumir el valor de un Context? **Respuesta** El hook useContext permite a los componentes hijos leer el valor proporcionado por el Provider más cercano en el árbol de componentes. Reemplaza la antigua API Consumer y ofrece una sintaxis más concisa y legible. El componente se volverá a suscribir automáticamente a los cambios del Context y se actualizará en consecuencia. ## 15 preguntas más disponibles - ¿Qué componente se usa para proveer un valor a un Context? - ¿Qué sucede si un componente usa useContext sin un Provider padre? Regístrate gratis: https://sharpskill.dev/es/login ## Otros temas de entrevista React / Next.js - [Fundamentos de JavaScript](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/javascript-essentials.md): 25 preguntas, Junior - [Fundamentos de React](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/react-fundamentals.md): 20 preguntas, Junior - [React Hooks](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/react-hooks.md): 22 preguntas, Junior - [Ciclo de vida de los componentes](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/component-lifecycle.md): 18 preguntas, Junior - [React Router](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/react-router.md): 20 preguntas, Junior - [Formularios y Controlled Components](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/forms-controlled-components.md): 20 preguntas, Mid-Level - [Obtención de datos y API](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/fetching-data-api.md): 20 preguntas, Mid-Level - [React Query (TanStack Query)](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/react-query-tanstack.md): 20 preguntas, Mid-Level - [Styling & CSS-in-JS](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/styling-css-in-js.md): 18 preguntas, Mid-Level - [Fundamentos de Next.js](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/nextjs-fundamentals.md): 25 preguntas, Mid-Level - [TypeScript con React](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/typescript-react.md): 20 preguntas, Mid-Level - [Data Fetching en Next.js](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/nextjs-data-fetching.md): 24 preguntas, Mid-Level - [Server Actions de Next.js](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/nextjs-server-actions.md): 20 preguntas, Mid-Level - [Routing y Navegación en Next.js](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/nextjs-routing-navigation.md): 22 preguntas, Mid-Level - [API Routes de Next.js](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/nextjs-api-routes.md): 20 preguntas, Mid-Level - [Metadata & SEO en Next.js](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/nextjs-metadata-seo.md): 18 preguntas, Mid-Level - [Middleware y Auth en Next.js](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/nextjs-middleware-auth.md): 22 preguntas, Mid-Level - [Testing en React](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/react-testing.md): 20 preguntas, Mid-Level - [Zustand State Management](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/zustand-state-management.md): 18 preguntas, Mid-Level - [Optimización de Rendimiento en React](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/react-performance-optimization.md): 22 preguntas, Senior - [Error Boundaries & Error Handling](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/react-error-boundaries.md): 18 preguntas, Senior - [Advanced React Patterns](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/advanced-react-patterns.md): 20 preguntas, Senior - [Características avanzadas de Next.js](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/nextjs-advanced-features.md): 24 preguntas, Senior - [Despliegue y Producción de Next.js](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/nextjs-deployment-production.md): 20 preguntas, Senior - [Architecture & Design Patterns](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/react-architecture-patterns.md): 22 preguntas, Senior - [React Server Components](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/react-server-components.md): 26 preguntas, Senior - [Internacionalización de Next.js](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/nextjs-internationalization.md): 20 preguntas, Senior - [React Security & Buenas Prácticas](https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/react-security-best-practices.md): 22 preguntas, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/es/technologies/react-next/preguntas-entrevista/state-management-context