You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

functions.any.js 768B

12345678910111213141516171819202122232425262728
  1. // @flow
  2. import { toState } from '../base/redux';
  3. /**
  4. * Gets the value of a specific React {@code Component} prop of the currently
  5. * mounted {@link App}.
  6. *
  7. * @param {Function|Object} stateful - The redux store or {@code getState}
  8. * function.
  9. * @param {string} propName - The name of the React {@code Component} prop of
  10. * the currently mounted {@code App} to get.
  11. * @returns {*} The value of the specified React {@code Compoennt} prop of the
  12. * currently mounted {@code App}.
  13. */
  14. export function getAppProp(stateful: Function | Object, propName: string) {
  15. const state = toState(stateful)['features/app'];
  16. if (state) {
  17. const { app } = state;
  18. if (app) {
  19. return app.props[propName];
  20. }
  21. }
  22. return undefined;
  23. }