Class

DynamicContentStore

DynamicContentStore

Allows any component to have its contents altered by adding, replacing or removing child elements to/from it.

Methods

# add(child, options) → {DynamicContentStore.CleanupFunction}

Adds a new child fragment
Parameters:
Name Type Description
child React.ReactElement.<any> child to add
options DynamicContentStore.ContentFragmentProps options of the child to add
callback when executed removes the added component

# remove(key, options) → {DynamicContentStore.CleanupFunction}

Removes an existing child fragment
Parameters:
Name Type Description
key React.Key key that identifies the fragment to remove
options DynamicContentStore.RemoveComponentCallOptions options of the child to remove
callback to undo remove request

# replace(child, options) → {DynamicContentStore.CleanupFunction}

Replaces a fragment with the given child by matching the fragment's key
Parameters:
Name Type Description
child React.ReactElement new child that will replace an existing fragment
options DynamicContentStore.ContentFragmentProps options of the new child
callback when executed removes the replaced component

Type Definitions

# CleanupFunction() → {void}

void
"start" | "end"

# ContentFragmentAlignment

Alignment of the fragment

# ContentFragmentConditionFunction(props) → {boolean}

Parameters:
Name Type Description
props object props T of the Component that includes the static prop named Content of type DynamicContentStore
whether the content fragment should be either added/replaced/removed or not
boolean
DynamicContentStore.ContentFragmentProps

# ContentFragmentProps

Props of content fragment
Properties:
Name Type Attributes Description
align DynamicContentStore.ContentFragmentAlignment <optional>
fragment alignment
replace boolean <optional>
whether the fragment should replace an existing one or not. Always set to true when calling `replace` method from DynamicContentStore
sortOrder number <optional>
index in which to position the fragment within the component.
if DynamicContentStore.ContentFragmentConditionFunction <optional>
function that returns whether the content fragment should be added or replaced.
React.ReactElement.<T>

# DynamicComponentChildren

Dynamically populated children which will receive props of type T.

# RemoveComponentCallOptions

Options for removing a component
Properties:
Name Type Attributes Description
if DynamicContentStore.ContentFragmentConditionFunction <optional>
function that returns whether the component should be removed or not.
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Protected by reCAPTCHA – PrivacyTerms