我在我的应用程序中使用 ngrx-store-localstorage 并收到以下警告:
警告:/Users/Me/angular-ngrx-material-standalone-starter/node_modules/ngrx-store-localstorage/fesm2022/ngrx-store-localstorage.mjs 取决于“deepmerge”。CommonJS 或 AMD 依赖项可能会导致优化救援。有关更多信息,请参阅: https ://angular.io/guide/build#configuring-commonjs-dependencies
我尝试在 angular.json 中添加 ngrx-store-localstorage,如下所示:
{
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": ["ngrx-store-localstorage"],
}
}
Run Code Online (Sandbox Code Playgroud)
正如医生所说,但警告仍然存在。
你能帮我吗?谢谢
我找不到在 React Native 中输入 FlatList 的方法
export interface Category {
id: string;
title: string;
bg: string;
}
export const CATEGORIES: Category[] = [
{ id: "c1", title: "Italian", bg: "#f5428d" }
];
const Item = ({ data }: { data: Category }) => (
<View style={styles.item}>
<Text style={styles.title}>{data.title}</Text>
</View>
);
const CategoriesScreen = ({ navigation }: CategoriesScreenProps) => {
const renderItem = ({
data,
}: {
data: Category;
}) => <Item data={data} />;
return (
<FlatList
data={CATEGORIES}
keyExtractor={(item) => item.id} …Run Code Online (Sandbox Code Playgroud) 如何使用 Typescript 输入 nextjs 错误页面
我尝试过:
interface ErrorProps {
statusCode: number;
}
function Error({ statusCode }: ErrorProps) {
return (
<p>
{statusCode
? `An error ${statusCode} occurred on server`
: "An error occurred on client"}
</p>
);
}
interface InitialProps {
res: NextApiResponse;
err: NextApiResponse;
}
Error.getInitialProps = ({ res, err }: InitialProps) => {
const statusCode = res ? res.statusCode : err ? err.statusCode : 404;
return { statusCode };
};
Run Code Online (Sandbox Code Playgroud)
但不确定这是正确的方法
我想在我的全新项目中使用打字稿,但我很难输入 HOC 组件
const withClass = (Wrapped: Component<any, {}, any>, className: string) => {
return props => (
<div className={className}>
<Wrapped />
</div>
);
};
Run Code Online (Sandbox Code Playgroud)
它不适用于此错误
类型错误:“typeof App”类型的参数不可分配给“组件”类型的参数。“typeof App”类型缺少“Component”类型中的以下属性:context、setState、forceUpdate、render 等 3 个。TS2345
那么正确的方法是什么?
谁能解释我为什么
npm init stencil
Run Code Online (Sandbox Code Playgroud)
无需在全球安装即可工作?
我习惯使用库,所有的都应该全局安装,所以我不明白为什么模板会这样工作......
我有这些路线
{
path: 'user',
canLoad: [AuthGuard],
loadChildren: () =>
import('./user/user.module').then((m) => m.PublicUserModule)
}
Run Code Online (Sandbox Code Playgroud)
{
path: '',
component: PublicUserPageComponent,
canActivate: [UserPhonesCheckGuard],
children: [
/*{
path: '',
pathMatch: 'full',
redirectTo: 'check'
},*/
{
path: 'account',
loadChildren: () =>
import('./account/user-account.module').then(
(m) => m.PublicUserAccountModule
)
},
{
path: 'check',
loadChildren: () =>
import('./check/user-check.module').then(
(m) => m.PublicUserCheckModule
)
}
]
}
Run Code Online (Sandbox Code Playgroud)
根据某些条件使用 UserPhonesCheckGuard 我想重定向或检查或帐户子路由,但使用
canActivate()
return this.router.parseUrl('/user/check');
}
Run Code Online (Sandbox Code Playgroud)
浏览器发疯了:(
我应该使用什么路径?
typescript ×3
angular ×2
javascript ×1
next.js ×1
ngrx ×1
ngrx-store ×1
react-native ×1
reactjs ×1
stenciljs ×1