我需要在 Node 项目之间共享一些功能,所以我在我的 Github 帐户中创建了一个私有存储库,然后将其添加到一个新项目中:
$ yarn add git+ssh://git@github.com:my_gh/my-api-types.git --dev
Run Code Online (Sandbox Code Playgroud)
我可以在node_modules/my-api-types目录中看到代码,我可以使用以下命令导入代码:
import { AccountResolvers } from "my-api-types";
Run Code Online (Sandbox Code Playgroud)
VS Code 不会发送任何错误消息,实际上 IDE 会正确显示 AccountResolvers 中的方法。但是当我想编译项目时,我得到:
ERROR in /home/manuel/customer-service/tsconfig.json
[tsl] ERROR
TS6307: File '/home/manuel/customer-service/node_modules/my-api-types/src/features/account/account.graphql.ts'
is not in project file list. Projects must list all files or use an 'include' pattern.
Run Code Online (Sandbox Code Playgroud)
我的tsconfig.json的错误地址,但我在其他项目中使用相同的文件没有问题:
{
"compilerOptions": {
"composite": true,
"target": "es2016",
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"outDir": "./dist/",
"noImplicitAny": true,
"skipLibCheck": true,
"jsx": "react",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true, …Run Code Online (Sandbox Code Playgroud) 顺便说一句,我对所有 AWS 工具都很陌生。无论如何,我已经创建了 Cognito 用户池,我可以创建和登录新用户,但我的 RDS 数据库中也需要这些字段。
昨天我正在阅读有关该问题的文档和教程,但看起来有很多方法可以同步两个数据源。我不知道 AppSync 之类的东西是否可以选择这样做,或者我需要编写一个两步 lambda,所以我正在为像你们这样更有经验的用户寻求建议。
有没有办法在Webpack 4上加载JSX文件?
我试过了:
module.exports = {
resolve: {
extensions: [".jsx", ".js"]
}
}
Run Code Online (Sandbox Code Playgroud)
但显然我的src/index.jsx文件已加载但未处理.
我在文件 APP/views/js/library.js.erb 文件中有一个视图,它包含:
bar: <%= raw @foo %>
Run Code Online (Sandbox Code Playgroud)
在 Rails 4 上,我使用以下方法获取了该视图的内容:
av = ActionView::Base.new(Rails.root.join('app', 'views'))
av.assign({ foo: my_dynamic_variable })
av.render(template: 'js/library')
Run Code Online (Sandbox Code Playgroud)
但在 Rails 6 上我得到:
NoMethodError: undefined method `html_fallback_for_js' for
"app/views/js/library":String
from /home/manuel/.rvm/gems/ruby-3.0.2/gems/actionview-
6.1.4.1/lib/action_view/base.rb:264:in `in_rendering_context'
Run Code Online (Sandbox Code Playgroud) 我在JS中看到这一行:
const myKnex = require('knex')(config);
Run Code Online (Sandbox Code Playgroud)
通常我会通过以下方式将其更改为TS:
import { myKnex } from 'knex';
Run Code Online (Sandbox Code Playgroud)
但是如何添加(config)部分?
求助:字段形式的defaultValue不是我想象的那样.
我不知道我在做什么[化学狗图片在这里].
我的组件称为loadForm,并通过thunk操作从API调用加载数据:
class loadForm extends Component {
constructor(props) {
super(props);
}
/* Loads data to the form */
componentDidMount() {
let action = getAppoThunk(this.props.routeParams.id);
this.props.dispatch(action);
console.log('DidMount appoArray>>'+ JSON.stringify(this.props.appo));
}
componentWillReceiveProps(nextProps) {
if (Object.keys(nextProps.appoArrayProp).length != Object.keys(this.props.appoArrayProp).length ) {
console.log('WWWW NOT THE SAME nextProps >>'+ JSON.stringify(nextProps.appo));
console.log('WWWW NOT THE SAME thisProps >>' + JSON.stringify(this.props.appo));
let action = getAppoThunk(this.props.routeParams.id);
this.props.dispatch(action); // thunk middleware dispatch
} else {
console.log('ARE THE SAME this.props.appo>>' + JSON.stringify(this.props.appo));
}
Run Code Online (Sandbox Code Playgroud)
}
渲染:
return(
<form onSubmit={this.handleSubmit}> …Run Code Online (Sandbox Code Playgroud) 我是 Clojure 的新手,一切都很新,但也很有趣。所以我有这个数据:
{:test {:title "Some Title"}, :questions [
{:id 1, :full-question {:question "Foo question", :id 1, :answers [{:id 7, :question_id 1, :answer "Foobar answer"}, {:id 8, :question_id 1, :answer "Foobar answer two"}]}},
{:id 5, :full-question {:question "Foo question", :id 5, :answers [{:id 12, :question_id 5, :answer "Foobar answer"}]}},
{:id 9, :full-question {:question "Foo question", :id 9, :answers [{:id 14, :question_id 9, :answer "Foobar answer"}, {:id 20, :question_id 9, :answer "Foobar answer two"}]}}
]}
Run Code Online (Sandbox Code Playgroud)
“经典”测试->问题->回答类型的数据结构。我有这个新信息:
(def new-answer {:id …Run Code Online (Sandbox Code Playgroud) 我有下一个字符串:
txt = "HwwwwjjaoHHHHaffgd"
Run Code Online (Sandbox Code Playgroud)
我需要通过对相同的连续字符进行分组来形成一个数组:
["H" "wwww" "jj" "a" "o" "HHHH" "a" "ff" "g" "d"]
Run Code Online (Sandbox Code Playgroud) typescript ×2
clojure ×1
javascript ×1
jsx ×1
reactjs ×1
redux ×1
redux-thunk ×1
regex ×1
ruby ×1
webpack ×1