1.1.2 • Published 4 years ago

brreg-components v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

brreg-components

A collection of components to help get accounts from the Brønnøysundregister API, still in early stages, expect changes

NPM JavaScript Style Guide

Install

npm install --save brreg-components

Usage

import * as React from 'react'
import {BrregSearcher} from 'brreg-components'
import { IAccount } from 'brreg-components/dist/interfaces/IAccount'

interface Props {
    SearchWord: string | undefined;
    onChange: (newValue: string | undefined) => void;
}
interface State {
    
}

export default class BrregSearchComponent extends React.Component<Props, State> {
    state = {}
    
    //function is called when the user clicks an account
    CallBackFunction(account: IAccount) {
        console.log(account)
        this.props.onChange(account.OrgNumber)
      }

    render() {
        return (
            <div >
                <BrregSearcher SearchTerm={"bygg"} SellectedAccountCallback={this.CallBackFunction.bind(this)}></BrregSearcher>
            </div>
        )
    }
}

License

MIT © Ballzer0

1.1.2

4 years ago

1.1.1

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago