/ionic-frameworks:ionic-reactfrom ionic-frameworks
Guides development of Ionic Framework apps with React, covering project structure, IonReactRouter, navigation patterns, lifecycle hooks, overlay hooks, state management, and best practices for Ionic 9 (React Router 6) and Ionic 7/8 (React Router 5).
Ships in ionic-frameworks. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Develop Ionic Framework apps with React — project structure, IonReactRouter, React-specific components, lifecycle hooks, state management, and best practices.
@ionic/react. This is the current major version, and all examples use it. Ionic 7 and 8 projects differ in routing, see the table below.Read the major version of @ionic/react in package.json before writing code.
| Topic | Ionic 9 | Ionic 7 and 8 |
|---|---|---|
| React | 18 or 19 | 17 or later |
| React Router | 6, not 7 (react-router@6, react-router-dom@6) | 5 (react-router@5, react-router-dom@5) |
| Route | <Route path="/home" element={<Home />} /> | <Route exact path="/home" component={Home} /> |
| Redirect | <Route path="/" element={<Navigate to="/home" replace />} /> | <Redirect exact from="/" to="/home" /> |
| Route with tabs or a nested outlet | Path ends with /* | Plain path |
| Picker overlay | Removed. Use the inline IonPicker in an IonModal. | useIonPicker hook |
useIonModal, useIonPopover | Props are type checked against the component | Props are any |
To move a project from Ionic 8 to 9, use the ionic-app-upgrades skill.
package.json dependencies (@ionic/react, @ionic/react-router, react, @capacitor/core), platforms (android/, ios/), build tools, and TypeScript usage. Only ask the user when something cannot be detected.Auto-detect the following by reading project files:
Ionic version: Read @ionic/react version from package.json.
grep -E '"@ionic/react"|"@ionic/react-router"|"react"|"react-router"|"react-router-dom"' package.json
React version: Read react version from package.json.
Capacitor version: Read @capacitor/core version from package.json (if present).
TypeScript: Check if tsconfig.json exists and if .tsx files are used.
Router: Check if @ionic/react-router and react-router-dom are in package.json, and read the major version of react-router-dom (6 or 5).
State management: Check package.json for redux, @reduxjs/toolkit, zustand, jotai, @tanstack/react-query, or similar.
Platforms: Check which directories exist (android/, ios/).
Build tool: Check for vite.config.ts, angular.json, webpack.config.js, etc.
A standard Ionic React project follows this structure:
project-root/
├── android/ # Android native project (Capacitor)
├── ios/ # iOS native project (Capacitor)
├── public/
├── src/
│ ├── components/ # Reusable UI components
│ ├── hooks/ # Custom React hooks
│ ├── pages/ # Page components (one per route)
│ ├── services/ # Service modules for API and native calls
│ ├── context/ # React context providers
│ ├── theme/
│ │ └── variables.css # Ionic CSS custom properties
│ ├── App.tsx # Root component with setupIonicReact(), the Ionic CSS imports and IonReactRouter
│ └── main.tsx # Entry point that renders <App />
├── capacitor.config.ts # Capacitor configuration
├── ionic.config.json # Ionic CLI configuration
├── package.json
├── tsconfig.json
└── vite.config.ts # Or other bundler config
If the project does not follow this structure, adapt all guidance to the project's actual directory layout. Do not restructure the project unless the user explicitly asks.
The app must call setupIonicReact() before it uses any Ionic React component. This function initializes the Ionic Framework for React. An Ionic starter calls it at the top level of src/App.tsx, after the imports and before the App component is defined.
Verify that src/App.tsx (or the entry file src/main.tsx / src/index.tsx) contains:
import { setupIonicReact } from '@ionic/react';
/* Core CSS required for Ionic components to work properly */
import '@ionic/react/css/core.css';
/* Basic CSS for apps built with Ionic */
import '@ionic/react/css/normalize.css';
import '@ionic/react/css/structure.css';
import '@ionic/react/css/typography.css';
setupIonicReact();
Find the call with grep -rn "setupIonicReact" src/.
setupIonicReact() accepts an optional configuration object for global settings:
setupIonicReact({
mode: 'ios', // Force iOS mode on all platforms ('ios' | 'md')
rippleEffect: false, // Disable Material Design ripple effect
animated: true, // Enable/disable all animations
});
If setupIonicReact() is missing or called after rendering, Ionic components will not function correctly.
The config option swipeBackEnabled is read once when an IonRouterOutlet mounts (Ionic 9). To switch the swipe back gesture at runtime, set the swipeGesture prop on IonRouterOutlet instead.
Read references/routing.md for complete routing patterns including:
IonReactRouter setupIonRouterOutlet page managementionPage propIonTabsIonMenuuseIonRouterKey principles for Ionic 9 (React Router 6):
IonReactRouter instead of React Router's BrowserRouter. It is required for Ionic page transitions.IonRouterOutlet to contain routes. It manages the page stack and transition animations. It must contain only Route elements.element prop of Route: <Route path="/home" element={<Home />} />. The props component, render and exact do not exist in React Router 6.Navigate: <Route path="/" element={<Navigate to="/home" replace />} />./* to the path of a route that renders tabs or a nested IonRouterOutlet: <Route path="/tabs/*" element={<Tabs />} />.useIonRouter for programmatic navigation — it provides Ionic-aware navigation with transition animations. Go back with router.goBack(), never with navigate(-1).In a project on Ionic 8 or older (React Router 5), pass the component prop to Route instead and do not use render or children inside IonRouterOutlet.
Read references/lifecycle.md for detailed lifecycle hook usage.
Ionic React pages stay mounted in the DOM after navigation. Standard React useEffect only fires on initial mount, not on every page visit. Use Ionic lifecycle hooks for per-visit logic:
| Hook | Use for |
|---|---|
useIonViewWillEnter | Refresh data before the page becomes visible |
useIonViewDidEnter | Start animations or focus inputs after page is visible |
useIonViewWillLeave | Pause media, save draft state |
useIonViewDidLeave | Cleanup after page is fully hidden |
These hooks only work in components that:
element of a Route inside IonRouterOutlet (the component in React Router 5).IonPage as their root element.Read references/hooks.md for all available hooks and usage examples.
Ionic React provides hooks for presenting overlays and controlling navigation without managing state manually:
| Hook | Purpose |
|---|---|
useIonAlert | Present alert dialogs |
useIonToast | Show toast notifications |
useIonActionSheet | Present action sheets |
useIonLoading | Show/dismiss loading indicators |
useIonModal | Present modals programmatically |
useIonPopover | Present popovers programmatically |
useIonRouter | Navigate with Ionic animations |
The hook useIonPicker is removed in Ionic 9 together with the overlay picker. Use the inline IonPicker inside an IonModal. See references/hooks.md.
Read references/components.md for detailed component patterns including:
IonPageisOpen bindingIonRefresherIonInfiniteScrollKey principles:
IonPage as root. This is required for transitions and lifecycle hooks.onIonInput for text inputs and onIonChange for select, toggle, checkbox, and range components.e.detail.value (or e.detail.checked for toggles/checkboxes).isOpen for simpler state management, or use overlay hooks (useIonModal, useIonAlert, etc.) for imperative usage.Read references/state-management.md for patterns with React Context, Redux Toolkit, Zustand, and TanStack Query.
Key principles:
useIonViewWillEnter to refresh stale data.IonReactRouter. Context providers, Redux Provider, and QueryClientProvider should wrap the router so all pages have access.useState/useReducer are sufficient.After implementing changes, build the web app and run it on a device or emulator. npx cap run syncs the project first. Without --target it asks in the terminal which device to use, so list the devices first and pass an ID:
npm run build
npx cap run android --list
npx cap run android --target <DEVICE_ID>
npx cap run ios --list
npx cap run ios --target <DEVICE_ID>
For development in the browser with live reload, start the dev server. The command does not exit, so run it in the background. --no-open stops it from opening a browser window:
ionic serve --no-open
For native development with live reload, pass the device and the IP address of the development machine. Without them the command asks in the terminal. It does not exit either, so run it in the background:
ionic cap run android --livereload --external --target=<DEVICE_ID> --public-host=<LAN_IP>
ionic cap run ios --livereload --external --target=<DEVICE_ID> --public-host=<LAN_IP>
<LAN_IP> is the IP address of the development machine in the local network, for example the output of ipconfig getifaddr en0 on macOS. The device must be in the same network.
IonPage as its root element and is the element of a Route inside IonRouterOutlet (the component in React Router 5). Lifecycle hooks do not fire in child components.IonReactRouter is used instead of BrowserRouter. Ensure every page renders IonPage as its root. In React Router 5, ensure routes use the component prop, not render or children.'Redirect' is not exported from 'react-router-dom', or useHistory is not exported: The project is on React Router 6 (Ionic 9), and the code uses the React Router 5 API. Use Navigate and useNavigate / useIonRouter. See references/routing.md./* suffix, or the nested IonRouterOutlet misses the ionPage prop.useIonModal or useIonPopover (Ionic 9): The second argument does not match the props of the component. See references/hooks.md.useIonPicker is not exported (Ionic 9): The hook is removed. Use the inline IonPicker inside an IonModal.useIonViewWillEnter to refresh data on every page visit instead of useEffect with [].IonRouterOutlet within IonTabs. Do not nest a separate IonRouterOutlet inside a tab page.setupIonicReact errors or components not rendering: Ensure setupIonicReact() is called at the top level of src/App.tsx (or in the entry file before the app renders). Ensure all Ionic CSS files are imported (see Ionic CSS imports in src/App.tsx or src/main.tsx).IonBackButton not appearing: IonBackButton only renders when there is navigation history. Set the defaultHref prop to provide a fallback route when the page is accessed directly.onIonInput for IonInput/IonTextarea (not onChange). Use onIonChange for IonSelect, IonToggle, IonCheckbox, IonRange. Access values via e.detail.value.IonContent. For modals, include IonHeader with IonToolbar if a toolbar is needed.useIonRouter returns undefined: The hook must be used inside a component that is a descendant of IonReactRouter. Verify the component tree includes IonReactRouter as an ancestor.src/App.tsx or src/main.tsx. The theme variables.css file must be imported after the core Ionic CSS.ionic-app-development — General Ionic development covering components, theming, and CLI usage.ionic-app-creation — Create a new Ionic app from scratch.capacitor-react — Capacitor-specific React patterns for accessing native device features (without Ionic Framework).ionic-app-upgrades — Upgrade Ionic Framework to a newer version.capacitor-plugins — Install, configure, and use Capacitor plugins from official and community sources.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub capawesome-team/skills --plugin ionic-frameworks3 skills in this plugin
/ionic-angularGuides the agent through Angular-specific patterns for Ionic app development. Covers project structure, standalone vs NgModule architecture detection, the Ionic 9 import paths (@ionic/angular and @ionic/angular/lazy) and the Ionic 8 paths, Angular Router integration with Ionic navigation (tabs, side menu, modals), lazy loading, Ionic page lifecycle hooks, zoneless change detection, reactive forms with Ionic input components, Angular services for state management, route guards, performance optimization, and testing with Vitest and Playwright. Do not use for creating a new Ionic app from scratch, upgrading Ionic versions, general Ionic component usage unrelated to Angular, Capacitor plugin integration, or non-Angular frameworks (React, Vue)./ionic-vueGuides the agent through Ionic Vue development patterns for Ionic 9 (Vue 3.5, Vue Router 5) and Ionic 8 — project structure, Vue-specific Ionic components (IonPage, IonRouterOutlet, IonTabs), navigation with Vue Router and useIonRouter, Ionic lifecycle hooks (onIonViewWillEnter, onIonViewDidEnter, onIonViewWillLeave, onIonViewDidLeave), composable utilities (useIonRouter, useBackButton, useKeyboard), tab-based routing, lazy loading, platform detection with isPlatform, and troubleshooting common Vue-specific issues. Do not use for general Ionic component theming or CLI usage (use ionic-app-development), creating a new Ionic app (use ionic-app-creation), Capacitor-specific Vue patterns without Ionic (use capacitor-vue), upgrading Ionic versions (use ionic-app-upgrades), or non-Vue frameworks like Angular or React.Other plugins' skills for the same job