Questions tagged [react-props]

ReactJS is a JS library developed by facebook. Props are the variables to be used in react components. Use tag when having doubts regarding usage of react props.

Reactjs is a JS library developed by facebook. React relies on making of components which handle variables through props.

Conceptually, components are like JavaScript functions. They accept arbitrary inputs (called “props”) and return React elements describing what should appear on the screen.

-React Documentation

3283 questions
0
votes
0 answers

i am trying to pass an object(i am fetching it form an api) as prop to a child component but when i console it inside the component it is not printing

I am trying to pass the array of object i am receiving from the api, i am using state to store the response from api then using map function to iterate through array and pass the object one by one but when i console it inside the Formss component i…
0
votes
2 answers

React- Props don't update when changing their state through the parent

The props on the 'GameState' component do not update correctly after changing their state from, they are always one iteration behind what the actual value of the state is as shown in the GIF and the sate is always one iteration behind when I try…
0
votes
0 answers

ReactJs does not render when I use props

There seems to be a problem with the function Card(props). The output is fine if I replace the function's content with
Earl Grey
  • 1
  • 1
0
votes
1 answer

Typescript props covert to javascript props

I need to use this directionLeft in the javascript file. currently in is in the typescript file. I need to know how to pass these props in the JSX file. Please help me to do that. import React from "react"; import { motion } from…
Nuwan Chamikara
  • 433
  • 1
  • 5
  • 17
0
votes
1 answer

Uncaught TypeError: lower.charAt(...).toUppererCase is not a function at capitalize Alert.jsx:6

` import React from "react"; function Alert(props) { const capitalize = (word) => { const lower = word.toLowerCase(); let msg = lower.charAt(0).toUppererCase() + lower.slice(1); return msg; }; return ( props.alert &&…
mjshubham21
  • 77
  • 1
  • 7
0
votes
1 answer

how to send the multiple form (screen) data to the same request in react native

i want to send the multiple form details to the single api in react native one of my friend suggest me to try to make a form object inside the parent component and then pass the form object to the children form and bind it. And then on Submit just…
0
votes
0 answers

Persist formik input values when the passed props to a react component changes

I have a child component witch gets some data passed as a prop to be used in a form handled by formik (line input options) . when this passed props changes due to an event in another component , this child component rerender and thus the form looses…
0
votes
0 answers

same props (makeUpdates.js 30)

In my project, I actually use the context api. Additionally, I pass the name of an image from my component to the context provider on onclick, and then I take the name from the provider and pass it to another component. It is operating flawlessly.…
David-JSON
  • 35
  • 8
0
votes
0 answers

Sending props to a React-component that uses Tailwind and is imported from a Node module does not change the styling

I have a several React projects where I import some UI-components from a private NPM-package. This UI-components package is also built using React and styled with Tailwind 3. The projects where I import the UI-components is using Tailwind 2 and…
0
votes
1 answer

React props wont change manually, how to get around restrictions?

When the component renders it has some children components and when i log props in the formgroup it looks like what's below. {$$typeof: Symbol(react.element), key: null, ref: null, props: {…}, type: ƒ, …} import React from 'react'; class…
Grant mitchell
  • 277
  • 1
  • 2
  • 12
0
votes
1 answer

I've created a dropdown component and called them thrice in a component. When I click one, all open

I'm clicking one component for the dropdown but all three of them are opening. I'm new to react so would love if someone could explain this to me! This is my Navbar component ` const Navbar = () => { const [selected, setSelected] =…
0
votes
1 answer

How to add property to prop(ReactComponent)

I wanna set properties (key/name) to props.answerComp/ Consider that props.answerComp = {answers.map((item,id)=> { setAnswers([...answers, props.answerComp]) // 1 // setAnswers([...answers,
0
votes
1 answer

Filter in react.js

I'm trying to make a filter of all my "localtypes" but when I check the console on my browser it shows me an empty array. I want to get to the localtypes propertys of the API I'm using I tried to use this filter const type = (category) => { …
0
votes
1 answer

How do i pass images property from state object as props

I need to pass an image from a state object to the card component that i made but it's not showing up at all what am i doing wrong here? parent class: import React, { Component } from "react"; import "bootstrap/dist/css/bootstrap.min.css"; import…
alienhana
  • 45
  • 6
0
votes
1 answer

The prop from another component using navigate is undefined

I would like to pass a prop using navigate. But it keeps giving me undefined. If I just call the child component, I see the right prop, but not navigate. This is my code below Parent component const navigate = useNavigate(); const componentChange =…
QPAO
  • 21
  • 3