menu

React

A community of developers, designers and others who love React.js. ⚛️

Channels
Team
Posts
Chat
Members
Info
Show previous messages

May 19, 2020 at 4:26pm
let { cats, isLoading, error } = useDataFetcher(BASE_URL);
const [searchTerm, setSearchTerm] = React.useState(''); let [catResults, setCatResults] = React.useState([cats]);
  • reply
  • like
therefore when i try to render carResults, the array is always empty at the start
  • reply
  • like
therefore when i try to render carResults, the array is always empty at the start
  • reply
  • like
cat*
  • reply
  • like

May 20, 2020 at 6:11am
I think you need to use useEffect like the following so that the catResults get set when yhe data is available:
  • reply
  • like
React.useEffect(() => {setCatResults(cats)}, [cats])
  • reply
  • like

May 23, 2020 at 11:14pm

May 24, 2020 at 1:04pm
hi
  • reply
  • like
Hi
  • reply
  • like

June 3, 2020 at 7:21am
I am new to react and have some questions
  • reply
  • like
I have craeted one component which takes data from api and render it. But can I separate out section inside map in separate component and use it inside parent component?
  • reply
  • like

June 3, 2020 at 3:19pm
Does anyone know about react obj viewer?
  • reply
  • like
hello, someone has suggestions of good open source react.js projects to contribute?
  • reply
  • like

June 4, 2020 at 5:26am
hello, someone has suggestions of good open source react.js projects to contribute?
is there anything specific area that you're interested in?
  • reply
  • like

June 5, 2020 at 2:07pm
Hi, using multiselect-react-dropdown, i can choose the option on double click only, how to make selectable in single click
Edited
  • reply
  • like

June 10, 2020 at 3:43am

June 11, 2020 at 9:43am
Hi, I have small query
  • reply
  • like
when rendering the list , i'm getting same values even though i mentioned unique prop value
  • reply
  • like

June 18, 2020 at 12:22pm

June 20, 2020 at 10:28am
Github.com/asfafasa/mern-client tell me what to do cant find error
  • reply
  • like

June 22, 2020 at 8:26am
hey, anybody here to help ?
  • reply
  • like

June 24, 2020 at 4:56pm
Can you help me in Approach for rendering static html file for home page and React app for rest
  • reply
  • like

June 28, 2020 at 10:39pm
Hi Developers, Please am finding it hard to read the URL params in my React Project after the user has click on the email link to reset password .The token is correct but am having problem here Please this is my code
class ActivitPassword extends Component { constructor(props) { super(props); this.state = { password: '' } this.handleChange = this.handleChange.bind(this) this.onSubmit = this.onSubmit.bind(this) this.token = this.token.bind(this) } handleChange =input => (event)=>{ event.preventDefault() this.setState({[input]: event.target.value}) } componentDidMount(){ this.token() } token = ()=>{ const token = this.props.match.params.token return token } onSubmit = (event)=>{ event.preventDefault() const saveLinkPassword = { password: this.state } event.preventDefault() axios.post(http://localhost:8000/user/activtypassword/:${this.token}, saveLinkPassword).then(res => res.json()).then(res => {toast.success("Password Update") }).catch(err => {toast.error(err.response.data)}) } render() { return ( <div className='passwordForgot'> <ToastContainer /> <h1>ENTER NEW PASSWORD</h1> <div className='recoverInput'> <label>PASSWORD: </label> <input placeholder='password' name="password" onChange={this.handleChange("password")}/> </div> <button className='btn btn-success' onClick={this.onSubmit}>Save Password</button> </div> ); } }
  • reply
  • like
Show more messages