title: How to use redux in a vanilla js class?
body: <p>I have a javascript class - not a React component - that acts as a service to handle logic tier (api call, etc.) in a React application. Its methods all use redux (useSelector or useDispatch), and everything works fine.</p>
  <p>However, the linter goes mad:</p>
  <blockquote>
  <p>React Hook &quot;useSelector&quot; cannot be called in a class component.</p>
  </blockquote>
  <p>The class looks like this:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>export class UserService implements ProjectService {
    private userService: UserService;
    constructor(dependencies: Dependencies) {
      this.userService = dependencies.userService;
    }
    public updateUserProfile(id: string) {
      const dispatch = useDispatch();
      return (user: User) =&gt; {
        return dispatch(Event.userManager(user));
      };
    }
  }</code></pre>
  </div>
  </div>
  </p>
  <p>How to refactor this?</p>