npm install @fabrick/react-component-library --save
// MyComponent.tsx
import {FbkElement} from "@fabrick/react-component-library";
//...
return <FbkElement foo={foo} bar="bar"/>
In order to make design-system web-components work with React, you must create its React wrapper in the
this library by creating a new .ts
file that looks like this:
import {FbkComponentName as FbkComponentClass} from '../../../component-library/src/components/fbk-component'
export const FbkComponentName = createComponent({ // should be the same of the element class
tagName: 'fbk-element-tag-name',
elementClass: FbkComponentClass,
react: React,
events: {
onCountClick: 'on-count-click' // remapping events in camelCase
}
});
Please read the project's root README.md