--- id: preact title: Preact --- [Preact](https://preactjs.com/) is a fast 3kB alternative to React with the same modern API. You can test Preact components directly in a real browser using WebdriverIO and its [browser runner](/docs/runner#browser-runner). ## Setup To setup WebdriverIO within your Preact project, follow the [instructions](/docs/component-testing#set-up) in our component testing docs. Make sure to select `preact` as preset within your runner options, e.g.: ```js // wdio.conf.js export const config = { // ... runner: ['browser', { preset: 'preact' }], // ... } ``` :::info If you are already using [Vite](https://vitejs.dev/) as development server you can also just re-use your configuration in `vite.config.ts` within your WebdriverIO config. For more information, see `viteConfig` in [runner options](/docs/runner#runner-options). ::: The Preact preset requires `@preact/preset-vite` to be installed. Also we recommend using [Testing Library](https://testing-library.com/) for rendering the component into the test page. Therefor you'll need to install the following additional dependencies: ```sh npm2yarn npm install --save-dev @testing-library/preact @preact/preset-vite ``` You can then start the tests by running: ```sh npx wdio run ./wdio.conf.js ``` ## Writing Tests Given you have the following Preact component: ```tsx title="./components/Component.jsx" import { h } from 'preact' import { useState } from 'preact/hooks' interface Props { initialCount: number } export function Counter({ initialCount }: Props) { const [count, setCount] = useState(initialCount) const increment = () => setCount(count + 1) return (