Uncaught TypeError: Cannot read properties of undefined (reading ‘render’) For a APP

I facing a problem

Here is my console output

The code is the following

import React from 'react';
import { ReactDOM } from 'react-dom';

import App from './App';

ReactDOM.render(<App />, document.getElementById('root'));

and i have

import React from 'react'
import { StreamChat } from 'stream-chat';
import { Chat } from 'stream-chat-react';
import Cookies from "universal-cookie";

import { ChannelListContainer, ChannelContainer } from './componets'

const apiKey = '6as5xshxu45b';

const client = StreamChat.getInstance(apiKey);

const App = () => {
  return (
    <div className="app__wrapper">
      <Chat client={client} theme="team light">
        <ChannelListContainer 
        
        />
        <ChannelContainer 
        
        />
      </Chat>
    </div>
  );
}

export default App;

and

import React from 'react'

const ChannelContainer = () => {
  return (
    <div>
      ChannelContainer
    </div>
  );
}

export default ChannelContainer;

and

import React from 'react'

const ChannelListContainer = () => {
  return (
    <div>
      ChannelListContainer
    </div>
  );
}

export default ChannelListContainer;

i am making a App if ur asking and pls help me
if you need for helping me more code that i have in there replay and say

email for help:

[email protected]

Dont look at this:

fgdh
hgfhgfhfghgf
gfjhggf

No suggestions after dot are shown

Now I use JS + WebdriverIO but when I type “.” to something no suggestions for methods are displayed.

describe(‘About page’, () => {

it(‘Verife URL and assert title’, async () => {

//go to url
await browser.url('website');

//assert
await expect(browser).

})
})

enter image description here

Also I use Cypress but there when I type /// everything is okay.

add data to an array within other arrays with a recursive function

I’m trying to add data to an element which inside it has an array, and that array others, and so on consecutively. I made a function to be able to traverse the entire element until finding the one I’m looking for by id, and then I add the new data to it and save it, but for some reason which I don’t know, the data in the console is shown exactly as I expect, but in MongoDB, the data is not updated, and I’m out of ideas.

CODE

import Folder from "../models/Folder";
import SubFolder from "../models/SubFolder";
import File from "../models/File";

export const createFolder = async (req, res) => {
  try {
    const { name, mainFolder, folderId } = req.body;

    if (!mainFolder && !folderId) {
      const newFolder = new Folder({
        name,
        rute: "esto va a ser la ruta",
        files: [],
        subFolders: [],
      });

      const folderSaved = await newFolder.save();

      res.json({
        message: "Carpeta creada",
        folder: folderSaved,
      });
    } else {
      const newSubFolder = new SubFolder({
        name,
        rute: "esto va a ser la ruta",
        mainFolder,
        files: [],
        subFolders: [],
      });

      if (mainFolder === folderId) {
        const findMainFolder = await Folder.findOne({ _id: mainFolder });

        findMainFolder.subFolders.push(newSubFolder);

        await findMainFolder.save();

        res.json({
          message: "Carpeta creada",
          folder: findMainFolder,
        });
      } else {
        const findMainFolder = await Folder.findOne({ _id: mainFolder });

        async function procesarSubCarpetas(folder) {
          for (const subFolder of folder.subFolders) {
            let subFolderId = subFolder._id;

            if (subFolder.subFolders.length > 0) {
              await procesarSubCarpetas(subFolder);
            }

            if (subFolderId.toString() === folderId) {
              subFolder.subFolders.push(newSubFolder);
              return;
            }
          }
        }

        await procesarSubCarpetas(findMainFolder);

        await findMainFolder.save();

        res.json({
          message: "Carpeta creada",
          folder: findMainFolder,
        });
      }
    }
  } catch (error) {
    console.error("Error al crear la carpeta:", error);
    res.status(500).json({ error: "Error al crear la carpeta" });
  }
};

I hope the data ends up in the database like this with the new data I’m trying to save.

This is what the console returns to me, but it doesn’t get saved.

{
    "message": "Carpeta creada",
    "folder": {
        "_id": "65b4cc91cf802c9ab1974106",
        "name": "Test1",
        "rute": "esto va a ser la ruta",
        "files": [],
        "subFolders": [
            {
                "name": "Test1",
                "rute": "esto va a ser la ruta",
                "mainFolder": "65b4cc91cf802c9ab1974106",
                "files": [],
                "subFolders": [
                    {
                        "name": "NewFile",
                        "rute": "esto va a ser la ruta",
                        "mainFolder": "65b4cc91cf802c9ab1974106",
                        "files": [],
                        "subFolders": [],
                        "_id": "65b4cf2852b5e3e59f172003",
                        "date": "2024-01-27T09:38:48.464Z"
                    }
                ],
                "_id": "65b4cc9dcf802c9ab1974108",
                "date": "2024-01-27T09:27:57.790Z"
            }
        ],
        "date": "2024-01-27T09:27:45.667Z"
    }
}

This is what I want to add to the database within the SubFolders.

{
 "name": "NewFile",
 "rute": "esto va a ser la ruta",
 "mainFolder": "65b4cc91cf802c9ab1974106",
 "files": [],
 "subFolders": [],
 "_id": "65b4cf2852b5e3e59f172003",
 "date": "2024-01-27T09:38:48.464Z"
}

Writing reusable front-end code for the web

I am preparing a presentation at work about writing frontend reusable code for the web: Javascript, HTML, CSS.

I feel like over almost 16 years of experience at it I have a lot to say in regards to frontend architecture and reusability, however I’d like to back what I know with sources. Doing a quick search on reusability doesn’t actually teach you a great deal of knowledge particular to frontend and I do realise this must be because it is quite a complex topic.

I also feel that over the years we’ve turned things back on its head and we are back at square one. We used to complain about files that contained HTML, Javascript and CSS and went to great lengths to separate these. However if you take a look at modern frontend code you’ll find mixing these is suddenly ‘cool’, and everything is wrapped into some kind of framework mechanism to do the thing, even if it’s just business logic. I find this very bad practice and I do notice that most companies, after 5 years of React(ing) are having to rewrite their applications because they became an unmaintainable mess. I want to make people think and realise how they can abstract their code a bit better so that it stands the test of time and it is more reusable.

To do that we used to abide by the mantra of separation of concerns because through the mere act of having more interdependent pieces in the puzzle, you were able to join them together in different ways. We used to say separate your code content, function and style because things will be easier to manage and reuse. I still think this stands true, but it’s hard to find a codebase that does it well or does it at all. It looks like we’re all in the grind coding away until we have to throw the whole thing away and start again from scratch. This is a lot of wasted time every 5 years.

IMHO business logic should be completely abstracted from components and in a framework agnostic frontend API that will stand the test of time, but I hardly ever see anyone thinking as such.

Also developers should try their best to abide by standards, because these will surely stand the test of time more than any new fancy framework tool. Also right now we’re in the best position ever to embrace them as they are evolving faster than they ever did.

These are just some of my thoughts off the top of my head.

I welcome healthy discussion on the subject and would be extra grateful for some good sources on the topic

Display Issue react-easy-crop with React MUI Dialog

I am struggling to fix the display of MUI Dialog with react-easy-crop . I want to display the dialog perfectly with react-easy-crop. However, react-easy-crop is covering the entire dialog. I tried to use the z-index but its not working.

 <Dialog open={openDialog} onClose={handleDialogClose} maxWidth='lg' fullWidth={true}>
        <DialogTitle>Crop Image</DialogTitle>

        <DialogContent>
          {src && (
            <ReactEasyCrop
              image={src}
              crop={crop}
              zoom={zoom}
              aspect={1}
              onCropChange={onCropChange}
              onZoomChange={onZoomChange}
              onCropComplete={handleCropComplete}
              cropShape='round'
            />
          )}
        </DialogContent>
        <DialogActions>
          <Button onClick={handleSaveCroppedImage} color='primary'>
            Save
          </Button>
          <Button onClick={handleDialogClose} color='primary'>
            Cancel
          </Button>
        </DialogActions>
      </Dialog>

Dialog Output

Get Value of Iterable Element

I have a list as shown below.
Now I want to get the values of each radio button when clicking on it. However, I get always the first value since the IDs (list-name) will be the same when rendered out the list.

Is there a simple way to do so? Maybe with onclick=function(this)

<form id="form-1">
{% for u in user %}
  <li>
    <div>
       <input id="list-name" type="radio" value="{{ u.name }}" name="list-radio">
       <label for="list-name">{{ u }}, {{ u.name }}</label>
    </div>
  </li>
{% endfor %}
</form>



<script>
    $(document).on('change', '#form-1', function (e){
      console.log($('#list-name').val())
    }
</script>

Deleting cookies created by google, but visible on my site?

I’m a bit confused as to how this happens:

enter image description here

They are created using a “Google Login” method. The login method works fine, but the issue I’m having, is that if someone logs in to the wrong account, there is no way for them to switch to another google account. My understanding of cookies, is that only you can create cookies on YOUR domain – not google (or anyone else)… so how do these exist , but with the domain .google.com ?

As a test, I’ve deleted those cookies, and then the next time it works as expected (asking them to select the account they want to log in as)

So, a silly question, but how can I “delete” those cookies? I’ve tried it with:

// Function to delete all cookies on the current domain
function deleteAllCookies() {
    var cookies = document.cookie.split(";");
    for (var i = 0; i < cookies.length; i++) {
      var cookie = cookies[i];
      var eqPos = cookie.indexOf("=");
      var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
      document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/";
    }
  }

But that only deleted the cookies where domain => mydomains (and not the .google.com ones)

There must be a way we can tell google to log us out, and show the account selection page again on the next login?

how to change audio output for a specific tab without extensions or inspect element in google chrome using bookmarks

I am on a managed chromebook and i want to watch my show while putting the kids show on the tv. I cant inspect element or install extensions. I think it may be possible with bookmarks though.

javascript:document.body.contentEditable = ‘true’; document.designMode=’on’; void 0

This bit of code allows me to edit the text on any site when i add it to my bookmarks and click it so i´m wondering if its possible to change audio output for a tab from a bookmark using the code that this site uses https://webrtc.github.io/samples/src/content/devices/multi/

How to change multiple array becomes array with object?

I try to use forEach and push a new array to achieve it, but the result is wrong.

const dummyArray = [
  [45292, 1, 2],
  [46292, 5, 6],
  [47292, 9, 10],
]

const resultArray: any[] = []

dummyArray.forEach((elementValue, index) => {
  resultArray.push({ date: '', price: '', code: '' })

  elementValue.forEach(value => {
    if (index === 0) {
      resultArray[index] = { ...resultArray[index], date: value }
    }
    if (index === 1) {
      resultArray[index] = { ...resultArray[index], price: value }
    }
    if (index === 2) {
      resultArray[index] = { ...resultArray[index], code: value }
    }
  })
})

console.log('resultArray', resultArray)

the result becomes

[
  { date: 2, price: '', code: ''},
  { date: '', price: 6, code: ''},
  { date: '', price: '', code: 10},
]

I want it becomes like

[
  { date: 45292, price: 1, code: 2},
  { date: 46292, price: 5, code: 6},
  { date: 47292, price: 9, code: 10},
]

How do I achieve it ?

How to make the row coloring work in Splunk JS?

My Splunk table contains four columns “Id”, “Name”, “Org”, “Salary”.

I want to mark all cells with bold font and some icons based on their values in “Salary”. This part is working.

Additionally, I also want to color (or highlight) those rows entirely which has a specific icon (“alert”) in the corresponding cell of the “Salary” column. This part is not working.

My JS code is below :

require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/tableview',
    'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView) {
     // Row Coloring Example with custom, client-side range interpretation
    var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
        canRender: function(cell) {
            // Enable this custom cell renderer for both the Age and the State field
            return _(['Id', 'Name', 'Org', 'Salary']).contains(cell.field);

        },
        render: function($td, cell) {
            // Add a class to the cell based on the returned value
            var value = cell.value;
            // Apply interpretation for number of historical searches
            if (cell.field === 'Salary') {
                if (value > 2) {
                 $td.addClass('range-cell').addClass('range-elevated');
                
                }
            var icon;

            if(value > 200) {

                icon = 'alert';
            } else if (value > 100) {
                icon = 'alert-circle';
            }
            else {

                icon = 'check';
               
            }
   
            // Create the icon element and add it to the table cell

            $td.addClass('icon-inline numeric').html(_.template('<%- text %> <i class="icon-<%-icon%>"></i>', {

                icon: icon,

                text: cell.value

            }));

        }
    });

    mvc.Components.get('table1').getVisualization(function(tableView) {
        // Add custom cell renderer
        tableView.table.addCellRenderer(new CustomRangeRenderer());
        tableView.on('rendered', function() {
            // Apply class of the cells to the parent row in order to color the whole row
            tableView.$el.find('td.range-cell').each(function() {
                $(this).parents('tr').addClass(this.className);
            });
        });
        // Force the table to re-render
        tableView.table.render(); 
    });  

});

And my css is below :

/* Custom Icons */
td.icon {
    text-align: center;
}
td.icon i {
    font-size: 25px;
    text-shadow: 1px 1px #aaa;
}
td.icon .severe {
    color: red;
}
td.icon .elevated {
    color: orangered;
}
td.icon .low {
    color: #006400;
}

.icon-inline i {
    font-size: 18px;
    margin-left: 5px;
}
.icon-inline i.icon-alert-circle {
    color: #ef392c;
}
.icon-inline i.icon-alert {
    color: #ff9c1a;
}
.icon-inline i.icon-check {
    color: #5fff5e;
}
/* Dark Theme */
td.icon i.dark {
    text-shadow: none;
}
/* Row Coloring */

 #table1 tr td {
     background-color: #c1ffc3 !important;
 }
 #table1 tr.range-elevated td {
     background-color: #ffc57a !important;
 }
 #table1 tr.range-severe td {
     background-color: #d59392 !important;
 }
 #table1 .table td {
     border-top: 1px solid #fff;
 }
 #table1 td.range-severe, td.range-elevated {
     font-weight: bold;
 }

What changes do I need to make to paint all rows having icon as “alert” to green (or any specific color) ?

Thanks

SwiperJs with reactJS, on Next click it skips the odd slides and on click Prev it skips the even slides

I have SwiperJs installed on my nextJS project.
Everything works perfectly, just the previous and next arrows skips slides.

Note: With left and right drag, it work fine. Just issues with NEXT and PREV arrows.

import React, { useState } from "react";
import { Navigation, Pagination } from "swiper";
import { Swiper } from "swiper/react";
import "swiper/swiper.min.css";
import "swiper/swiper-bundle.min.css";
import "swiper/swiper-element.css";
import "./smoke-swiper.scss";

/*
props:
- chidlren => Swiper slides
- Style => Swiper root style
*/
const SmokeSwiper = ({ children, style }) => {
  return (
    <div className='smoke-swiper_root'>
      <Swiper
        style={{ maxWidth: "600px", maxHeight: "400px", ...style }}
        spaceBetween={30}
        pagination={{
          type: "fraction", // clickable: true,dynamicBullets: true,
        }}
        navigation={true}
        modules={[Navigation, Pagination]}
        className='mySwiper'>
        <div>{children}</div>
      </Swiper>
    </div>
  );
};

export default SmokeSwiper;

I am expecting the slides with work in sequence [1,2,3,4….] with Next and Prev arrow events.