Plugin Templates
Copy-pastable example snippets for accelerating plugin development
Method of a component
In this example - render
const render = (args, callback, instance) => (
<>
{ callback.apply(instance, args) }
</>
);
export default {
'Component/NAME/Component': {
'member-function': {
render
}
}
};Container functions
Common case - when you need to pass an additional function from parent to child
Prop types
You need to add an additional prop to propTypes after passing an additional prop to the component? No problem!
Default props
Not required new propType - do this.
More state
Additional fields for the state.
Adding a Reducer to the Redux Store
Add reducers to the application as follows.
Query fields
Additional query field shown below!
Reducer Initial State
mapStateToProps
Connect an additional piece of state to the component
mapDispatchToProps
Connect an additional dispatch function to the component
Adding a Route to the Router
Note how we use async import(...) statement here in order to optimize bundle sizes!
Extending maps
Example: creating a new tab in MyAccount
Last updated
Was this helpful?