@bubblydoo/angular-react
Advanced tools
Comparing version 0.0.19 to 0.1.0
{ | ||
"name": "@bubblydoo/angular-react", | ||
"version": "0.0.19", | ||
"version": "0.1.0", | ||
"license": "MIT", | ||
@@ -17,23 +17,3 @@ "author": "Hans Otto Wirtz <hansottowirtz@gmail.com>", | ||
"tslib": "^2.3.0" | ||
}, | ||
"module": "fesm2015/bubblydoo-angular-react.mjs", | ||
"es2020": "fesm2020/bubblydoo-angular-react.mjs", | ||
"esm2020": "esm2020/bubblydoo-angular-react.mjs", | ||
"fesm2020": "fesm2020/bubblydoo-angular-react.mjs", | ||
"fesm2015": "fesm2015/bubblydoo-angular-react.mjs", | ||
"typings": "bubblydoo-angular-react.d.ts", | ||
"exports": { | ||
"./package.json": { | ||
"default": "./package.json" | ||
}, | ||
".": { | ||
"types": "./bubblydoo-angular-react.d.ts", | ||
"esm2020": "./esm2020/bubblydoo-angular-react.mjs", | ||
"es2020": "./fesm2020/bubblydoo-angular-react.mjs", | ||
"es2015": "./fesm2015/bubblydoo-angular-react.mjs", | ||
"node": "./fesm2015/bubblydoo-angular-react.mjs", | ||
"default": "./fesm2020/bubblydoo-angular-react.mjs" | ||
} | ||
}, | ||
"sideEffects": false | ||
} | ||
} | ||
} |
@@ -124,2 +124,37 @@ # React in Angular and Angular in React | ||
### Refs | ||
You can get a ref to the Angular component instance as follows: | ||
```tsx | ||
import { ComponentRef } from '@angular/core'; | ||
const ref = useRef<ComponentRef<any>>(); | ||
<AngularWrapper ref={ref} />; | ||
``` | ||
To get a reference to the Angular component's HTML element, use `ref.location.nativeElement`. | ||
To forward a ref to a React component, you can simply use the props: | ||
```tsx | ||
const Message = forwardRef((props, ref) => { | ||
return <div ref={ref}>{props.message}</div>; | ||
}); | ||
@Component({ | ||
template: `<react-wrapper [component]="Message" [props]="{ ref, message }">` | ||
}) | ||
export class MessageComponent { | ||
Message = Message; | ||
message = 'hi!'; | ||
ref(div: HTMLElement) { | ||
div.innerHTML = 'hi from the callback ref!'; | ||
} | ||
} | ||
``` | ||
## Developing | ||
@@ -126,0 +161,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unpopular package
QualityThis package is not very popular.
Found 1 instance in 1 package
0
191
22498
21
486
1