在React的模板文字中插入html标签

时间:2019-03-12 11:04:17

标签: javascript reactjs template-literals

我在React中有带有模板文字的变量:

const weatherForecast = `
  Today in <strong>${this.state.cityName}</strong>
  weather will be with <strong>${today.weather_state_name}</strong>,
  min temperature <strong>${parseInt(today.min_temp)}°C</strong>,
  max temperature <strong>${parseInt(today.max_temp)}°C</strong>,
  and humidity will be <strong>${today.humidity}%</strong>
`;

,我想在其中插入HTML代码,如您所见,这就是tag。这可能吗,我该怎么做。我用谷歌搜索,但找不到答案。

0 个答案:

没有答案