React escapes all strings to be displayed in the DOM to prevent XSS. So, if JSX contains escaped entity characters, such as © (©). React automatically copies &; The special character in the.

Solution:

import React, { Component } from 'react';
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import ThemeSwitch from './ThemeSwitch'

class Header extends Component {
  static propTypes = {
    themeColor: PropTypes.string
  }

  render () {
    return (
      <div>
        <h1 style={{ color: this.props.themeColor}} >{['cc ', <span>&copy;</span>, '2015']}</h1>
        <h1 dangerouslySetInnerHTML={{__html: 'cc &copy; 2015'}} ></h1>
        <h1 style={{ color: this.props.themeColor}} >cc  <span>&copy;</span> 2015</h1>
        <ThemeSwitch/>
      </div>
    )
  }
}

const mapStateToProps = (state) => {
  return {
    themeColor: state.themeColor
  }
}
Header = connect(mapStateToProps, null)(Header)

export default Header
Copy the code