无法将我的React组件/ jsx设置为具有动态表格宽度

我正在尝试在我的一个React组件中设置一张表格,使其具有动态表格宽度。但是,在尝试执行此操作时,总是会收到此错误:

Syntax error: Unexpected token (37:50)

  35 |                     </tr>
  36 |                     <tr>
> 37 |                         <td style={{ width: 100% }}>

当我有一个简单的数字(例如100或500)但不使用百分比时,它可以工作。

React / JSX是否可以呈现动态表?

谢谢!

guotenglin534577320 回答:无法将我的React组件/ jsx设置为具有动态表格宽度

尝试@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_favorite); ArrayList<String> favoriteList = (ArrayList<String>) getIntent().getStringArrayListExtra("FAVOURITE_LIST"); //Your favorite list of title is here. Now call the adapter and attach with recyclerview to show this ... } <td style={{ width: "100%" }}>

,

您收到错误消息,因为React / JSX无法识别您所指的宽度:100%。用100%引号引起来,错误就会消失。

本文链接:https://www.f2er.com/3156949.html

大家都在问