我正在开发一个react-rails应用程序,我在控制台中不断收到此错误:
```
Warning: validateDOMNesting(...): <th> cannot appear as a child of <thead>.
See (unknown) > thead > th.
Run Code Online (Sandbox Code Playgroud)
我不确定为什么这不起作用..我想使用标题(thead)表格,它适用于其他人.我会放tbody,但我需要那个表的实际主体.
这是我这个表的代码:
```
React.DOM.table
className: 'table table-bordered'
React.DOM.thead null,
React.DOM.th null, 'Description'
React.DOM.th null, 'Actions'
React.DOM.tbody null,
for post in @state.posts
React.createElement Post, key: post.id, post: post,
handleDeletePost: @deletePost
Run Code Online (Sandbox Code Playgroud)
**编辑我已经尝试在thead下添加tr标签,这会导致额外的错误增加.这就是我将代码更改为:
```
React.DOM.table
className: 'table table-bordered'
React.DOM.thead null
React.DOM.tr null
React.DOM.th null, 'Description'
React.DOM.th null, 'Actions'
React.DOM.tbody null,
for post in @state.posts
React.createElement Post, key: post.id, post: post,
handleDeletePost: @deletePost
Run Code Online (Sandbox Code Playgroud)
我得到的下一个错误是:警告:validateDOMNesting(...):tr不能作为表的子项出现.见(未知)>表> tr.添加一个代码以匹配浏览器生成的DOM树.
我是新手做出反应而不熟悉咖啡因,所以我想知道它是否与间距或其他东西有关.测试了不同的间距,这没有帮助.我把所有的东西拿出去了,这导致我的应用程序破了......不确定是什么问题
我正在创建一个包含设计的rails应用程序.我正在尝试使用Ngrok将Twilio消息传递到我的网站,我使用了本教程:https://www.twilio.com/blog/2016/04/receive-and-reply-to-sms-in-rails.html
我能够在控制台中打开Ngrok并获取他们为我的网址提供的网络ID.当我将网址插入我的浏览器时,我不断收到此错误.我应该到我自己的rails本地应用程序.不确定什么是错的.
我在为ngrok制作的消息控制器中添加的内容:
class MessagesController < ApplicationController
skip_before_filter :verify_authenticity_token
skip_before_filter :authenticate_user!, :only => "reply"
def reply
message_body = params["Body"]
from_number = params["From"]
boot_twilio
sms = @client.messages.create(
from: Rails.application.secrets.twilio_number,
to: from_number,
body: "Hello there, thanks for texting me. Your number is #{from_number}."
)
#twilio expects a HTTP response to this request
end
private
def boot_twilio
account_sid = Rails.application.secrets.twilio_sid
auth_token = Rails.application.secrets.twilio_token
@client = Twilio::REST::Client.new account_sid, auth_token
end
end
Run Code Online (Sandbox Code Playgroud)
真的不确定是什么问题.当它没有连接到'def reply'时,authenticate_user应该由devise定义.