New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-lightning-renderer

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-lightning-renderer

A React custom renderer implementation targeted to Salesforce Lightning Component development

latest
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

react-lightning-renderer

A React custom renderer implementation targeted to Salesforce Lightning Component development

Install

$ npm install react-lightning-renderer

Example

  • JavaScript (should be bundled using webpack or other bundler, and added as a static resource)
import React from 'react';
import { Button, render, handleEvent } from 'react-lightning-renderer';

class CounterApp extends React.Component {
  constructor() {
    super();
    this.state = { count: 0 };
  }
  render() {
    const { count } = this.state;
    return (
      <div>
        <p>
          Count: { count }
        </p>
        <Button
          iconName="utility:add"
          onclick={ () => this.setState({ count: this.state.count + 1 }) }
        />
        <Button
          iconName="utility:dash"
          onclick={ () => this.setState({ count: this.state.count - 1 }) }
        />
      </div>
    );
  }
}

function init(cmp) {
  render(<CounterApp />, cmp);
}

export { init, handleEvent };
  • Lightning Component (.cmp file)
<aura:component implements="flexipage:availableForAllPageTypes">
	<ltng:require scripts="{!$Resource.MyComponentApp + '/bundle.js'}"
		afterScriptsLoaded="{!c.doInit}"
	/>
	{!v.body}
</aura:component>
  • Lightning Component Controller
({
	doInit: function(cmp, event, helper) {
		window.MyComponentApp.init(cmp);
	},
	handleEvent: function(cmp, event) { // the controller method name always must be `handleEvent`
		window.MyComponentApp.handleEvent(cmp, event);
	}
})

Deploying example components to your org

This repository includes example lightning components implemented with react-lightning-renderer. To deploy the example components to your development org, do the following:

$ git clone https://github.com/stomita/react-lightning-renderer.git
$ cd react-lightning-renderer
$ npm install
$ SF_USERNAME=XXXX SF_PASSWORD=YYYY npm run deploy:example

FAQs

Package last updated on 26 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts