i am creating a chatting application with pusher in laravel and using react j s for front-end.now when i use Echo.channel in react js it shows channel is not defined.how to solve this problem or any alternative way to do this???
this is in my App.js:
import Echo from 'laravel-echo'
window.Pusher = require('pusher-js');
window.Echo = new Echo({ broadcaster: 'pusher', key: process.env.MIX_PUSHER_APP_KEY, cluster: process.env.MIX_PUSHER_APP_CLUSTER, forceTLS: true });
and this is in my react js chatUi :
listen = () => {
window.Echo.channel('my_channel'); channel.listen('FormSubmitted', function (data) { alert(JSON.stringify(data)); }); }