Fork me on GitHub
#clojure-china
<
2019-07-29
>
tianshu14:07:25

怎么启动?

tianshu14:07:01

yarn shadow-cljs release app ?

hulunote14:07:30

yarn start 是 启动 react项目

hulunote14:07:57

yarn shadow-release 是 编译出来 js

hulunote14:07:11

yarn shadow-watch 是 开发cljs,dev的

tianshu14:07:28

我现在cljs编译好了,我启动react是yarn start么?

tianshu14:07:18

嗯,重现问题了

tianshu14:07:25

@stevechan 你的main.js地址取到的不是js

hulunote14:07:32

那是啥呀?

tianshu14:07:32

你在浏览器里面看

hulunote14:07:13

因为这个html被react自动修改过加入 script 标签

hulunote14:07:18

那是有格式错误?

tianshu14:07:37

这个显然不是一个JS

hulunote14:07:28

那怎么弄? rich

hulunote14:07:58

show cljs 编译出来是ok的js,

tianshu14:07:27

我有点不知道你是怎么做到这个的

hulunote14:07:04

我就是先创建了一个react项目:npx create-react-app react-app-cljs

hulunote14:07:26

然后:lein new shadow-cljs jarvis-eshell-shadow-cljs-reagent +reagent 创建了个 shadow-cljs项目

tianshu14:07:33

你的react项目自己能跑么?

hulunote14:07:56

把两个项目合并了一下

hulunote14:07:16

react项目能跑呀,

tianshu14:07:45

能的话react的项目加上一个cljs编译最后的js就好了。

hulunote14:07:53

我只是要写出来个例子,实现 ReactDOM.render("这里是Reagent的Component", document.getElementById('root')); 就行啦

tianshu14:07:31

<script src="public/js/compiled/main.js"></script>

tianshu14:07:05

这个地址看起来好像不是很对

hulunote14:07:28

我改过来了

hulunote14:07:07

我提交上去了

hulunote14:07:00

那怎么才能 在jsx文件里面引用到 Reagent 写的Component呢?

hulunote14:07:22

屏幕快照 2019-07-29 下午10.50.24

tianshu14:07:18

收到我发的内容了么