File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -145,18 +145,19 @@ def use_effect(
145145 Returns:
146146 If not function is provided, a decorator. Otherwise ``None``.
147147 """
148- if inspect .iscoroutinefunction (function ):
149- raise TypeError (
150- "`use_effect` does not support async functions. "
151- "Use `use_async_effect` instead."
152- )
153148
154149 hook = HOOK_STACK .current_hook ()
155150 dependencies = _try_to_infer_closure_values (function , dependencies )
156151 memoize = use_memo (dependencies = dependencies )
157152 cleanup_func : Ref [_EffectCleanFunc | None ] = use_ref (None )
158153
159154 def decorator (func : _SyncEffectFunc ) -> None :
155+ if inspect .iscoroutinefunction (func ):
156+ raise TypeError (
157+ "`use_effect` does not support async functions. "
158+ "Use `use_async_effect` instead."
159+ )
160+
160161 async def effect (stop : asyncio .Event ) -> None :
161162 # Since the effect is asynchronous, we need to make sure we
162163 # always clean up the previous effect's resources
You can’t perform that action at this time.
0 commit comments