Uncaught (in promise) Error: TypeError: Cannot read properties of null (reading 'map')

I want to retrieve all returned data

<script>


    export default (props, { $on, $f7, $update}) => {

        let notifications = null;


        $on('pageInit', (e) => {

  
   

                // request user data on page init

                $f7.request.postJSON("https://xxxxxx/api/mobile/notifications", function (data) {


                     notifications = data

                    console.log(data)

                    $update();

                }, function (data) {


                });

        })




        return $render;
    };
</script>

//I want to retrieve all returned data

${notifications.map((item) => $h`

 `)}

I used to browse the data with “each” but with f7-cli I don’t understand

let notifications = [];