I'm wondering if it's possible to use command line arguments with ReactJS (not react-native). For example, is it possible to input a simple string and have it be saved as a variable so it can be displayed? The npm yargs module is the kind of thing I'm looking for, but I couldn't get that to work because the child process it spawns apparently doesn't work in a browser.
我想知道是否有可能使用命令行参数与反应物(非反应式本机)。例如,是否可能输入一个简单的字符串并将其保存为一个变量,以便显示它?npm yargs模块是我正在寻找的东西,但是我不能让它工作,因为它生成的子进程显然不能在浏览器中工作。
Edit: I've also tried something like including {process.argv[0]}
in say an h1 tag, but nothing shows up.
编辑:我也尝试过包括{进程。argv[0]}表示h1标签,但是什么都没有显示。
1 个解决方案
#1
0
React doesn't have anything special for command line arguments. In fact, it is primarily designed as a DOM library. You could use yargs and then pass the values to a React component.
React对于命令行参数没有什么特别的东西。实际上,它主要设计为DOM库。您可以使用yargs,然后将值传递给React组件。
#1
0
React doesn't have anything special for command line arguments. In fact, it is primarily designed as a DOM library. You could use yargs and then pass the values to a React component.
React对于命令行参数没有什么特别的东西。实际上,它主要设计为DOM库。您可以使用yargs,然后将值传递给React组件。