hunk.code_window: import {
     createContext,
     createElement,
     useContext,
     useState,
     FC,
     useEffect
   } from 'react'
   import { cache as defaultCache } from './config'
   import { initCache } from './cache'
   import { mergeConfigs } from './merge-config'
  
hunk.labels: replace replace replace replace replace replace replace replace keep keep keep
hunk.after_edit: import { createContext, createElement, useContext, useState, FC } from 'react'
  
hunk.file_path: src/utils/config-context.ts
hunk.type: replace
file: # Optimistic UI with Immer
  
  ## One-Click Deploy
  
  Deploy your own SWR project with Vercel.
  
  [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/master/examples/optimistic-ui-immer)
  
  ## How to Use
  
  Download the example:
  
  ```bash
  curl https://codeload.github.com/vercel/swr/tar.gz/master | tar -xz --strip=2 swr-master/examples/optimistic-ui-immer
  cd optimistic-ui-immer
  ```
  
  Install it and run:
  
  ```bash
  yarn
  yarn dev
  # or
  npm install
  npm run dev
  ```
  
  Deploy it to the cloud with [now](https://vercel.com/home) ([download](https://vercel.com/download))
  
  ```
  now
  ```
  
  ## The Idea behind the Example
  
  Example of how to use SWR and Immer to implement an Optimistic UI pattern where we mutate the cached data immediately and then trigger a revalidation with the API.
  