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

Accessing Raw Components

Going back to our example:

const WrappedComponent = withCurrentUser(MyComponent);

This would result a new WrappedComponent component that has MyComponent as a child. This has the consequence that properties and objects you set on MyComponent might not exist on WrappedComponent.

For that reason, BlueRain provides a getRawComponent utility that lets you access the unwrapped “raw” component, provided said component has been registered with set:

MyComponent.foo = "bar";
const WrappedComponent = BR.Components.set(MyComponent, withCurrentUser);
console.log(WrappedComponent.foo); // undefined
console.log(BR.Components.getRawComponent(WrappedComponent).foo); // "bar"
PreviousReplacing ComponentsNextComponents & HoCs

Last updated 6 years ago