score:0
So I found a way, but it seems a much more Javascript way and seems to ignore many of the things which make react worth using, such an not directly interacting with the DOM:
In the fiddle this will be placed in the PlusContentHolder
part
const titleInfoHandler = (x) => {
let titleArray = [];
let allTerms = {};
document.getElementsByName("title").forEach((title) =>{
titleArray.push(title.value)
})
for(let i = 0; i < titleArray.length; i++){
allTerms[i] = {...allTerms[i], title: titleArray[i]}
}
setPlusContent((prevState) => {
return{...prevState, titleArray}})
props.titlePointer(plusContent)
};
I am still looking for a better way, as I have more than just a title input in this component, so any feedback, criticism etc. would be appreciated :)
Source: stackoverflow.com
Related Query
- React: same component reappearing multiple times in the app, how can I make sure that all states are captured accurately and not just the last?
- How can I use the same React app in multiple locations of the same page?
- How can I use a React component on multiple instances on the same page?
- How to make sure that ReactDOM.createPortal in App component runs in while I mount the same in my test case?
- How can I start my node server and react app at the same time?
- How can I use react useContext , to show data from context, in the same component
- How can I make sure a React parent component loads data before its child component mounts?
- Can component styles be scoped instead of inline to prevent overwriting by multiple React apps on the same page?
- Force remount component when click on the same react router Link multiple times
- How would a share the state of the same React component across multiple pages?
- Testing Library : How to render the same component multiple times without coupling
- Props mix when using the same component multiple times on a page in React
- How can I manage multiple setState calls in the same React component?
- React Router v6 : How to render multiple component inside and outside a div with the same path
- I want to make sure the Post Is Not Liked multiple times by The same user using Firebase
- How can I make a config file to import the same modules for multiple jest tests?
- How can I create a counter as components to use multiple times and create one button to reset all the counter in React JS?
- React how to display multiple components of different origin on the same parent component
- how to make sure I dont get exception error or any kind of error in React that stop execution or crashes the app
- How do I make it so that the React router shows multiple elements when routing to the same address?
- How can I create multiple instances of a React component (having an infinite animation) with different values for the :root variables
- How can I store the value of an async function to be used multiple times in a function without having to make the async call multiple times?
- How can we make sure other <ListItem> components as collapsible when one <ListItem> component get expands under <List> react material ui component?
- React : How to make the SAME component re-render?
- How can I 'not allow' the user to retrieve same information from the server multiple times in my 'React' Weather-app?
- How can I make onSumbit react the same as action/method of a form?
- How to make a reusable dropdown filter in ReactJS which is DRY and can be used twice in the same component
- How can I use different properties for the same component using Styled Component for React JS?
- How Can I make my React Button Component updates CSS only on the specific page?
- How can I make my React Component mount, when the right url is accessed and the user is not logged in?
More Query from same tag
- How to implement gatsby-remark-images-grid in markdown using Gatsby.js
- Is a good convention using semicolon at the end of the line when using ES6 in babel
- Redirect Login React
- Auto scroll to anchor tag element in react using componentDidUpdate
- Toggling value inside React component with useState not working
- React-Redux problem with update operation
- React Hooks: How to make a POST request to server
- react multiple state const for jsx
- Dynamically set font with React
- State is always default value when test with another value
- How to test changes made by onClick event that calls a setState function, which is passed from another component and changes UI?
- Receiving prop in Material UI and conditional rendering
- Display latest entry among objects of same property value
- Imports path in react
- Redirect with props - React Router - Cannot read property 'props' of undefined
- Best way to proceed to have both public and private routes on a single web app using Keycloak and React router?
- Loop through every nested child of React Children
- Use of useSelector redux hooks
- compare two arrays of Objects in JavaScript and if true save new items to MongoDB
- how to give full width to table cell in react + material?
- Why does "npm install" tell me "none is installed You must install peer dependencies yourself:"?
- React Hooks. How to make other items(beside current one) deactivate when i click
- React: Why child stopped re-render the 3rd times
- React jest test with enzyme error
- How to make a reusable component with proper, testable event handlers in ReactJS
- How do I duplicate an array with components?
- How to get buttons to the end of material ui list and checkbox to the start of the list?
- How to import a JS Library within my React app?
- How to use 'toHaveClass' to match a substring in Jest?
- Kubernetes Nginx Ingress and Socket.io Connection Issues