Sha256: e4dc86e6971270b3db2fb7803bfed4e0a32390510a575042ecd9a308b183351b

Contents?: true

Size: 384 Bytes

Versions: 23

Compression:

Stored size: 384 Bytes

Contents

import JasonContext from './JasonContext'
import { useContext, useEffect } from 'react'

export default function useSub(config, options = {}) {
  // useEffect uses strict equality
  const configJson = JSON.stringify(config)
  const subscribe = useContext(JasonContext).subscribe

  useEffect(() => {
    // @ts-ignore
    return subscribe(config, options).remove
  }, [configJson])
}

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
jason-rails-0.8.7 client/src/useSub.ts
jason-rails-0.8.6 client/src/useSub.ts
jason-rails-0.8.4 client/src/useSub.ts
jason-rails-0.8.3 client/src/useSub.ts
jason-rails-0.8.2 client/src/useSub.ts
jason-rails-0.8.1 client/src/useSub.ts
jason-rails-0.7.5.1 client/src/useSub.ts
jason-rails-0.8.0 client/src/useSub.ts
jason-rails-0.7.5 client/src/useSub.ts
jason-rails-0.7.3 client/src/useSub.ts
jason-rails-0.7.2 client/src/useSub.ts
jason-rails-0.7.1 client/src/useSub.ts
jason-rails-0.7.0 client/src/useSub.ts
jason-rails-0.6.8 client/src/useSub.ts
jason-rails-0.6.7 client/src/useSub.ts
jason-rails-0.6.6 client/src/useSub.ts
jason-rails-0.6.5 client/src/useSub.ts
jason-rails-0.6.4 client/src/useSub.ts
jason-rails-0.6.3 client/src/useSub.ts
jason-rails-0.6.2 client/src/useSub.ts