CustomSearch Component Library POC
CustomSearch component is a reusable React.js compnonent which can be injected in any application.
This componet can be injected in Angular and React.js projects
The library adintel-lib-poc
contains multiple reusable components like Button
and CustomSearchWrapper
Commands
Install the component library using below command
npm install adintel-lib-poc
Angular Example
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { AfterViewInit, Component, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
import { CustomSearchWrapper } from 'adintel-lib-poc';
@Component({
selector: 'react-custom-search',
template: '<div id="rootId"></div>',
})
export class ReactSearchComponent implements OnInit, OnChanges, AfterViewInit, OnDestroy {
title = 'test-app';
public rootId = 'rootId';
public searchData: any;
ngOnInit() {
}
ngOnChanges(changes: SimpleChanges) {
this.render();
}
ngAfterViewInit(): void {
this.render();
}
ngOnDestroy(): void {
}
public handleSearchData = (payload: any) => {
}
private render() {
ReactDOM.render(React.createElement(CustomSearchWrapper,
{
searchData: this.searchData,
handleSearchData: this.handleSearchData
}
), document.getElementById(this.rootId));
}
}