Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

98
Visualizações
react hook and class bypass

Hi i'm new in web developpement i'm studying in a adult school to change my career my question is simple i'm developping my end of the year project and doing it with react JS i'm comfortable with class component, i needed to acess URL params with class component so i did this:

import React from "react";
import {Component} from "react";
import {useParams} from "react-router-dom"

export default function ParamsReader(){
    return <CategoriesComponent params={useParams()}/>
}
class CategoriesComponent extends React.Component{
    constructor(props){
        super(props)
        this.state={

        }
    } componentDidMount(){
        console.log(this.props.params);
        Object.entries(this.props.params).map((param)=>(
            console.log(param[1])

        ))
    } render(){

        return(
            <div>
                <h1>HELLO</h1>
            </div>
        )
    }
}


this is working i can acces what i need (the componentDidMount is just here to check what i retrieve in my class) but my question is: is it a good practice? BOth of the function and the class are in the file should i slplit them in différent files? thanks for youres answers

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda