我们有Null合并操作符.NET,我们可以使用如下
string postal_code = address?.postal_code;
Run Code Online (Sandbox Code Playgroud)
我们可以在React JS中做同样的事情吗?
我发现我们可以使用&&运算符
在address.ts文件中
string postal_code = address && address.postal_code;
Run Code Online (Sandbox Code Playgroud)
我需要什么样的.net功能可以在typescript中使用react JS,这可能吗?
就像是:
string postal_code = address?.postal_code // I am getting the error in this line if I try to use like .NET
Run Code Online (Sandbox Code Playgroud) This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom'
我收到上述错误,而试图将整个应用程序从反应v15.6到v16.2,通过使用迁移工具从Facebook等jscodeshift。