php – WordPress VS React?

Our website is currently built on WordPress…most of the website (homepage, blogs, pages, etc…)
We use React for parts of the website (product and equipment pages that use facets/filters to sort through products).

WordPress is fairly simple to work with, but can get buggy with conflicting plugins, updating WordPress versions, etc… However creating page templates, pages, blogs, etc… is fairly simple and quick to work with. All pages are fully responsive for desktop and mobile.

I want to keep elements of the website with WordPress (homepage, blogs, pages, etc…) due to their ease of use and great page speed.
Some people at our company want to convert everything to React and get rid of WordPress.

Any reasons why we should keep parts of the website in WordPress and not convert to React?

architecture – How much should a react frontend application be automated tested?

I’m backend developer working on a very backend heavy application. So most of the business logic is writen in the backend. In our project we are considering a full rewrite of the frontend. Currently the frontend code is extremely messy and refactoring stuff takes forever. There are no tests.

I’m not a frontend developer eventhough I have made some contributions to the code and have a good overview on how the current code looks like. In the backend we have really good experience with writing test driven development. So I naturally through the some should be true for frontend development. But looking at from the perspective that the frontend is mainly visualizing data and calling rest api’s to invoke business logic. I’m considered if a strict test driven approach would be very cumbersome, with a lot of mock objects and allot testing overhead.

What are your experiences how much should you test? What do you do in your daily job and how does it work for you?

javascript – Created a basic User Profile List using an API (React)

I’m relatively new when it comes to programming in React and in JavaScript, but have a surface level understanding of what things do. I’ve created a basic program that fetches user data from an API that generates random users, and appends the users to a list when you click a button. I was wondering if what I’m writing is good enough to be considered for a Jr. React Dev position, and if there’s anything I can improve upon the code such as implementation, name convention, readability, efficiency, etc. In particular, in the UserProfile component, I’m mapping through the state that holds the JSON object that was fetched from the API to output the profile picture and name. I’m not sure if there’s anyway to do it better, but it doesn’t feel quite right to me. Any feed back is much appreciated.

UserProfile.jsx

import React, { useState, useEffect } from "react";

const UserProfile = () => {
  const (userData, setUserData) = useState(());

  const fetchUserData = () => {
    fetch("https://randomuser.me/api")
      .then((resp) => resp.json())
      .then((data) => setUserData(data.results));
  };

  //Creates userProfile with picture/full name
  const userProfile = (userMeta) => {
    const {
      name: { first, last },
      picture: { medium }
    } = userMeta;

    return (
      <>
        <img src={medium} alt="" />
        <p>
          {first}, {last}
        </p>
      </>
    );
  };

  //Fetch API data on component mount
  useEffect(() => {
    fetchUserData();
  }, ());

  return (
    <>
      {userData.map((userMeta, idx) => {
        return <div key={idx}>{userProfile(userMeta)}</div>;
      })}
    </>
  );
};

export default UserProfile;

UserList.jsx

import React, { useState } from "react";
import UserProfile from "./UserProfile";

const UserList = () => {
  const (userList, setUserList) = useState(());

  //Appends UserProfile to List
  const addUser = () => {
    setUserList((prevState) => {
      return (...prevState, <UserProfile />);
    });
  };

  return (
    <div>
      <button onClick={addUser}>Add User</button>
      {userList.map((user, idx) => {
        return <React.Fragment key={idx}> {user} </React.Fragment>;
      })}
    </div>
  );
};

export default UserList;

App.js

import React from "react";
import UserList from "./UserList";

export default function App() {
  return (
    <div className="App">
      <p>USER LIST COMPONENT</p>
      <UserList />
    </div>
  );
}

I built a custom .NET Core distributed system with Docker, React, Consul and RabbitMQ. Would anyone

Advertising

y u no do it?

Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

Starts at just $1 per CPM or $0.10 per CPC.

react – Meu componente não atualiza o valor da const, após minha função receber um novo dado

Boa tarde, estou com um componentente recebendo uma função aonde a mesma atualiza dependendo do onClick. Até ai tudo bem está funcionando e recebendo, porém quando jogo essa função em outro componente a mesma não atualiza o valor da const que esta recebendo a função ao click.

segue o codigo

export function AcessoDePorta(observerPortas$) {
 const { portaID } = PortaoCondominio();
 const (accessDoor, setAccessDoor) = React.useState();

 React.useEffect(() => {
   setAccessDoor(
     portaID?.filter(
       (viewporta) => viewporta.condominio_id === observerPortas$,
     ),
   );
 }, (observerPortas$));

 return accessDoor;
}

Essa e a função que está funcionando direito. Porem quando eu envio ela para cá,

const BlocoPortao = () => {
  const accessDoor = AcessoDePorta();
  console.log(accessDoor);
  const accessDoor2 = acessoDePortas();
  const accessAcao = acessoDeAcao();
  const (att, setAtt) = React.useState();
  const (toggles, setToggles) = React.useState(false);

a mesma não atualiza ela chega como undefined e quando o outro codigo atualiza, este não e atualizado.

sharedpreferences – React Native Async Storage

I am using Aysncstorge in my app to save a value. it was working fine. her is my code.

  const Authorize = dispatch => async () =>{
        console.log("calledddd")
            try{
              let islogin = await  AsyncStorage.getItem('islogin')
               console.log(islogin)
            }catch(error){
                console.log(error)
            }
       console.log("called last")
    }

I also tried it like this.

 AsyncStorage.getItem('islogin').then((islogin) => {
     console.log(islogin)
}).catch((error) => {
     console.log(error)
 })

React leaflet draw on image

I am trying to use the drawing function of react-leaflet Where not drawing a map, but drawing on a picture
Right now I have to use the function inside do you have any suggestions? Or if it can’t be done

<Map center={center} zoom={ZOOM_LEVEL} ref={mapRef} >
            < Image />
          <FeatureGroup>
            <EditControl
              position="topright"
              onCreated={_onCreate}
              onEdited={_onEdited}
              onDeleted={_onDeleted}
              draw={{
                rectangle: false,
                polyline: false,
                circle: false,
                circlemarker: false,
                marker: false,
              }}
            />
          </FeatureGroup>
          </Map>

javascript – REACT ERROR: en el archivo chokidar.js, no me deja compilar mi proyecto

Realicé un proyecto con npx create-react-app , estaba trabajando en el y de repente salió el siguiente error:

    Failed to compile
./node_modules/watchpack/lib/chokidar.js
SyntaxError: C:UsersUsuarioDesktopReact projectsTheFilmAppthefilmappnode_moduleswatchpacklibchokidar.js: 'return' outside of function (4:1)

  2 | try {
  3 |   module.exports = require("chokidar");
> 4 |   return;
    |   ^
  5 | } catch(e) {
  6 |   v3Err = e;
  7 | }
This error occurred during the build time and cannot be dismissed.

Si alguno me ayuda a solucionarlo , se lo agradeceré ya que no me deja continuar con mi proyecto

javascript – Button onPress not printing console log in react native

In Below code am unable to understand why onPress function is not getting called and thereby not printing anything on console.

import * as React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack'

import { Button, Text } from 'react-native'
const stack1 = createStackNavigator()
const stack2 = createStackNavigator()
function buttonPressed(){
  console.log("TarunD screen1")
}
const screen1 = () => {
  return (
    <>
      <Text>
        Hello Screen1
      </Text>
      <Button 
        title="screen1 button"
        onPress={buttonPressed}
      />
    </>
  )
}

const screen2 = ()=>{
  return (
    <Text>
      Hello Screen2
    </Text>
  )
}
const App = () => {
  console.log("Hello App")
  return (  
  <NavigationContainer>
    <stack1.Navigator>
      <stack1.Screen name="Screen1" component={screen1}/>
    </stack1.Navigator>
  </NavigationContainer>)

}

export default App

Basically defined onPress and a button.
Am just trying to print console logs in the button, do you see anything wrong?