【问题标题】:React + Typescript : TypeScript error: Type 'string' has no properties in common with type 'CSSProperties'React + Typescript:TypeScript 错误:类型“字符串”与类型“CSSProperties”没有共同的属性 【发布时间】:2019-09-09 09:55:40 【问题描述】: 我正在使用带有 React 的 Typescript,目前正面临这个问题 【问题讨论】: 标签: css reactjs typescript 【解决方案1】: style 属性需要一个具有样式属性而不是字符串的对象: style={{ backgroundImage: "url('https://source.unsplash.com/07fzqFEfLlo/1920x1080')" }} See the React docs on the subject. 【讨论】: