algolia / react-element-to-jsx-string

Turn a ReactElement into the corresponding JSX string

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inconsequent string wrapping

albingroen opened this issue · comments

Input

  const Element = () => (
    <div>
      <p>
        {`{t('Cool')}`}
      </p>
      <p>
        {`t('Cool')`}
      </p>
    </div>
  )

Expected output

  const Element = () => (
    <div>
      <p>
        {t('Cool')}
      </p>
      <p>
        t('Cool')
      </p>
    </div>
  )

Actual output

  const Element = () => (
    <div>
      <p>
        {`{t('Cool')}`}
      </p>
      <p>
        t('Cool')
      </p>
    </div>
  )

Why is the first p element getting wrapped in {``}, bet second not. I expect the first to act as the second (ie. not get wrapped.)