1.0.24 • Published 6 years ago
lightning-jsx-redux v1.0.24
Lightning-jsx-redux
This library enables use of jsx syntax with redux connect when developing lightning apps Lightning framework documentation.
Setup
npm install lightning-jsx-redux --save-dev
Add the following to your babelrc config:
{
"plugins": [
"lightning-jsx-redux/babel"
]
}
Before your lightning app is initiated you will need to provide lightning-jsx-redux
library with your redux store.
import { createStore } from "redux";
import { provide } from "lightning-jsx-redux";
export const store = createStore(myReducer);
provide(store);
Here's an example of a connected jsx component:
import { connect } from "lightning-jsx-redux";
const myComponent = (state, actions) => (
<text
x={110}
y={110}
text={{
fontSize: 24,
text: state.myState,
fontStyle: "bold",
textColor: 0xff636efb
}}
updated={(newState, oldState, self) => {
// My update logic
self.patch({
text: {
text: newState.myState
}
});
// Dispatch my redux action
actions.myFunc("someValue");
}}
firstActive={(currentState, currentProps, self) =>
console.log("First time visible")
}
active={(currentState, currentProps, self) =>
console.log("Visible on screen")
}
inactive={(currentState, currentProps, self) =>
console.log("Not visible on screen")
}
/>
);
export default connect(
state => ({ myState: state.myState }),
{ myFunc: value => ({ type: "SOME_ACTION", input: value }) }
)(myComponent);
1.0.24
6 years ago
1.0.23
6 years ago
1.0.22
6 years ago
1.0.21
6 years ago
1.0.20
6 years ago
1.0.19
6 years ago
1.0.18
6 years ago
1.0.17
6 years ago
1.0.16
6 years ago
1.0.15
6 years ago
1.0.14
6 years ago
1.0.13
6 years ago
1.0.12
6 years ago
1.0.11
6 years ago
1.0.10
6 years ago
1.0.9
6 years ago
1.0.8
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago