1.0.2 • Published 3 years ago

fix-hmr v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

fix-hmr

In some cases, such as styled-components, code renewal by HMR is not performed properly.

This function fixes some cases in which HMR is not working.

Usage

import styled from 'styled-components'

function ComponentBase({className}) {
  return <div className={className} />
}

export const Component = styled(ComponentBase)`
  font-size: 1em;
`

If HMR doesn't work,

import { fixHMR } from 'fix-hmr'
import styled from 'styled-components'

function ComponentBase({className}) {
  return <div className={className}/>
}

const StyledComponent = styled(ComponentBase)`
  font-size: 1em;
`

export const Component = fixHMR(StyledComponent)