作者imjeffreylee (jl)
看板Ajax
标题[问题] React + Rails选取不到元件
时间Sat Apr 18 13:10:16 2020
大家好,最近在用react跟rails做全端开发,可是一开始就遇到问题(跪)
不知道这里用RoR的人多不多 不过还是想问问看
我有一个root page长这样
https://imgur.com/3fdsRIE
然後这是我主要load html的档案
https://imgur.com/MuI9xvd
那个yeild就是root page出现的地方
然後这是我的React component
https://imgur.com/kU1SasH
浏览器里<h1>Welcome to Intro-Me</h1>显示不出来,
但是可以看到<main id="root">test: should not see this</main>
https://imgur.com/E1QA3sv
所以我初步判定rails view的部分没问题(有问题的话应该连root都显示不出来)
然後丢了两个debugger在react component里面
发现浏览器根本撞不到debugger
所以我觉得问题出在webpack.config.js
https://imgur.com/AZLxnke
可是我实在找不出错误在哪,也问了好几个人(包括google小姐)
Stack overflow发问也没人回答,
是有人用comment提供意见啦但是帮助不大(还是感谢他)
希望PTT大神可以救我QAQ
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 207.96.90.111 (美国)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Ajax/M.1587186620.A.30E.html
※ 编辑: imjeffreylee (207.96.90.111 美国), 04/18/2020 13:11:18
※ imjeffreylee:转录至看板 Ruby 04/18 13:13
※ imjeffreylee:转录至看板 Web_Design 04/18 13:15
※ imjeffreylee:转录至看板 Programming 04/18 13:17