BlueRain OS
  • Introduction
  • API
    • API Reference
  • Guides
    • Apps
      • Installation
      • Creating an App
      • Configuration
    • Components
      • Registering Components
      • Extending Components
      • Replacing Components
      • Accessing Raw Components
      • Components & HoCs
    • Filters
      • Known Filters
    • Plugins
      • Installation
      • Configuration
      • Creating a Plugin
  • Miscellaneous
    • JSON to React
  • Plugins
    • Apollo
    • Internationalization
    • Material UI
    • React Router
    • Redux
    • Redux Devtools
    • Why Did You Update
Powered by GitBook
On this page
  1. Guides
  2. Components

Extending Components

Components are generally defined as functional stateless components, unless they contain extra logic (lifecycle methods, event handlers, etc.) in which case they'll be defined as ES6 classes.

For components defined as ES6 classes, make sure you extend the original component. This will let you pick and choose which methods you actually need to replace, while inheriting the ones you didn't specify in your new component.

In order to extend the original, non-wrapped component we use the getRawComponent method:

class CustomLogo extends BR.Components.getRawComponent('Logo'){
  render() {
    return (
      <div>/* custom component code */</div>
    )
  }
}
BR.Components.replace('Logo', CustomLogo);
PreviousRegistering ComponentsNextReplacing Components

Last updated 6 years ago