Skip to content

v2.3.0

Compare
Choose a tag to compare
@Ayc0 Ayc0 released this 02 May 18:28
  • remove polyfill for matchMedia (it should be define by the users) minor breaking change
  • add new hook useQuery and use it internally in Only for the prop matchMedia
  • drop query in useOnly BREAKING CHANGE
    • as there is a new hook useQuery that deals with media queries, the 2nd argument of useOnly was redundant
    • new signature:
      • before: useOnly = (on?: string, media?: string, strict?: boolean) => boolean | undefined
      • after: useOnly = (on?: string, strict?: boolean) => boolean | undefined
    • as on and media were join with a or, you can still mimic the previous behavior by doing:
      • before:
        const isVisible = useOnly(on, media, strict);
      • after:
        const a = useOnly(on, strict);
        const b = useQuery(media);
        const isVisible = a || b;