File size: 719 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'use cache'

// This file simulates adding a "use cache" directive to a client module that's
// mistaken as a server module. It does not have itself a "use client"
// directive, but is imported by a client module with a "use client" directive,
// while also importing another client module with a "use client" directive.
// Adding the "use cache" directive here, effectively forces the module to be a
// server module, which then results in an error when trying to call the client
// function.

import { useStuff } from './client-module'

export async function useCachedStuff() {
  // Intentional misusage (using hooks in async functions).
  // eslint-disable-next-line react-hooks/rules-of-hooks
  return useStuff()
}