如何使用Angular中的反应发表的NPM组件

发布于 2025-02-13 07:24:25 字数 680 浏览 0 评论 0原文

我创建了简单的React组件,并发布给NPM注册表。它与React的工作正常,但我想在Angular Project中使用相同的插件,其显示以下错误。

插件: https://www.npmjs.coms.coms.com/package/package/reactcustcustcustcustcustcustcustompungin

自定义 到角模块。

npm i reactcustomplugin

AppModule.ts

import SayHello from 'reactcustomplugin';
import { NgModule } from '@angular/core';

@NgModule({
  imports: [
    SayHello] })  ==> getting below error
     ,

type'({name}:{name:string;})=>元素'不能分配键入'任何[] |类型| ModulewithProviders< {}>'

I have created simple react component and published to NPM registry. its working fine with react but I want to use same plugin in angular project its showing below error.

Custom plugin : https://www.npmjs.com/package/reactcustomplugin

error while importing plugin to angular module.

npm i reactcustomplugin

appmodule.ts

import SayHello from 'reactcustomplugin';
import { NgModule } from '@angular/core';

@NgModule({
  imports: [
    SayHello] })  ==> getting below error
     ,

Type '({ name }: { name: string; }) => Element' is not assignable to type 'any[] | Type | ModuleWithProviders<{}>'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清醇 2025-02-20 07:24:25

显然,您不能使用用react编写的包裹或其他任何内容的包装...

obviously, you can't use the package written in react for angular or anything else ...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文