Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
arc-m
Advanced tools
Readme
(arc-m stands for Angular React Component Module)
Angular module for wrapping react components in order to use them directly in angular components.
npm i arc-m
⚠️ Doesn't work with AOT-compliler for now.
prop-types
to describe the component props.import * as React from 'react';
import {string, func} from 'prop-types';
export const HelloWorld = ({name, onClick}) => (
<div>
<p>Hello {name}</p>
<button onClick={onClick}>Click me!</button>
</div>
);
HelloWorld.propTypes = {
name: string,
onClick: func,
};
Register the react component and just use it
a. via reference
import {Component} from '@angular/core';
import {registerReactComponents} from 'arc-m';
import {HelloWorld} from './hello-world';
const [helloWorld] = registerReactComponents([HelloWorld]);
@Component({
selector: 'my-ng-component',
template: `
<div>
${helloWorld(`<ARC [name]="name" (onClick)="handleOnClick"></ARC>`)}
</div>
`,
})
export class MyNgComponent {
name = 'you';
handleOnClick() {
alert('👍');
}
}
ARC
is just a placeholder for the actual component selector of HelloWorld
and can be changed.
The selector of the angular component which wraps the react component is created dynamically.
b. or with a custom selector
import {Component} from '@angular/core';
import {registerReactComponents} from 'arc-m';
import {HelloWorld} from './hello-world';
registerReactComponents([
[HelloWorld, 'hello-world']
]);
@Component({
selector: 'my-ng-component',
template: `
<div>
<hello-world [name]="name" (onClick)="handleOnClick"></hello-world>
</div>
`,
})
export class MyNgComponent {
name = 'you';
handleOnClick() {
alert('👍');
}
}
Import arc module
import {NgModule} from '@angular/core';
import {ArcModule} from 'arc-m';
import {MyNgComponent} from './my-ng.component';
@NgModule({
imports: [
ArcModule,
],
declarations: [
MyNgComponent,
]
})
export class MyNgModule {
}
registerReactComponents
APIregisterReactComponents(
Array<
object | // React component reference
[
object | // React component reference
string // Custom selector for wrapping angular component
]
>,
{
placeholder: string, // @default: "ARC" Placeholder which gets overwritten when template function is called
selectorPrefix: string, // @default: "react-component-" Prefix of dynamically created selector of angular component
}
)
FAQs
Angular module for wrapping react components in order to use them directly in angular components
The npm package arc-m receives a total of 4 weekly downloads. As such, arc-m popularity was classified as not popular.
We found that arc-m demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.