1.0.6 • Published 4 years ago

@anteniyus/react-plus-component v1.0.6

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

@anteniyus/react-plus-component

A general component that can add or remove a specific component and also gives you the state of all existing components.

NPM JavaScript Style Guide

Install

npm install --save @anteniyus/react-plus-component

Usage

import React, { Component } from 'react'

import MyComponent from '@anteniyus/react-plus-component'

class Example extends Component {
  render() {
    return <MyComponent />
  }
}

Here is an example of using react-plus-component

import React, { Component } from 'react';

import { PlusComponent } from '@reza/react-plus-component';
import RepeatComponent from './Repeat';

export default class App extends Component {
  constructor(props) {
    super(props)
    this.ref = React.createRef()
  }

  add = () => {
    return this.ref.current.addComponent();
  };

  remove = () => {
    return this.ref.current.removeComponent();
  };

  getState = () => {
    return this.ref.current.getState();
  };

  render() {
    return (
      <div>
        <button onClick={this.add}>add</button>
        <button onClick={this.remove}>remove</button>
        <PlusComponent ref={this.ref} component={<RepeatComponent />}/>
      </div>
    );
  }

}

License

MIT © Reza

react-plus-component

1.0.6

4 years ago

1.0.5

4 years ago

1.0.2

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago