Category : reactjs

I created a React app based on Free Code Camp’s Drum Machine project which works successfully on Code Pen and passes all tests found here https://codepen.io/kevin-orara/pen/RwKvjJz however when I transfer the code to Visual Studio it now fails 1 test. Yes the app appears to work and even compiled successfully. Now it is failing one ..

Read more

Let’s say I have two different lists related to the same domain, like: const [peopleList, setPeopleList] = useState([]) const [equipmentList, setEquipmentList] = useState([]) I’m defining only one handler to deal with the changes on those lists: const handleListChange = (e, type) => { type === ‘people’ ? setPeopleList(e.target.value) : setEquipmentList(e.target.value) } And passing it to ..

Read more

So i am recently working on this collaborative text editor using React, and socket.io. My app.js looks somewhat like this : const [content, updateContent] = useState(”); socket.on("update", (data)=>{ if(access === true){ currContent = data updateContent(data) } }) const contentBlock = htmlToDraft(content); const contentState = ContentState.createFromBlockArray(contentBlock.contentBlocks); const editorState = EditorState.createWithContent(contentState); class ControlledEditor extends Component { constructor(props) ..

Read more

I am kind of new with with typescript and react combined. So here I have Context and simple Modal funcions and states, I wanna use them globally but it is not letting me pass them in the HomeContext.Provider value. Is interface good? import React,{useState} from "react"; import { useHistory } from "react-router-dom" const HomeContext = ..

Read more