AppmakerDeveloper

How to pass params between pages

This is a doc to show how to pass params between pages.

Description

This is a doc to show how to pass params between pages.

Steps

  1. In the action to open the second page, pass the params.
onAction({
        action: 'OPEN_INAPP_PAGE',
        pageId: 'VideoPage',
        params: {
          videoId: 'videoId'
        }
      });
  1. In the second page, you can get the params using two methods. In the page object or in the component's props.
  • In the Page file,

const page = {
  blocks: [
    {
      name: 'my-custom-video-block',
      attributes: {
        videoId: '{{currentAction.params.videoId}}'
      }
    },
    // other blocks
  ]
}
  • In the block component's props

const MyCustomVideoBlock = (props) => {
  const { currentAction, attributes } = props;
  const videoId = currentAction?.params?.videoId || attributes?.videoId;
  // do something
  return <video src={videoId} />
}

On this page