Convertion of Website into WordPress
-
I am fed up from custom website errors and want to convert from react to wordpress again because wordpress manage everything by itself automatically and i like it!!!
I discussed with developement experts to do it for me but they rejected and said the below given function is not working as per your requirement, they reverted back all but my few pages are now not getting indexing
import React, { useEffect, useState } from ‘react’; const WordPressReactComponent = () => { // Error 1: State initialization const [postData, setPostData] = useState([]); // Error 2: Incorrect useEffect dependency array useEffect(() => { // Error 3: Fetching data from the WordPress REST API fetch(”) .then(response => response.json()) .then(data => setPostData(data)) .catch(error => console.error(‘Error fetching data:’, error)); }, []); // Make sure to add dependencies if needed return ( <div> {/* Error 4: Rendering data from state */} {postData.map(post => ( <div key={post.id}> <h2>{post.title.rendered}</h2> {/* Error 5: Incorrectly rendering content */} <div dangerouslySetInnerHTML={{ __html: post.content.rendered }} /> </div> ))} </div> ); }; export default WordPressReactComponent;
Please any expert who knows about it help me for this, Thanks!
- This topic was modified 1 year, 2 months ago by . Reason: wordpress post url was added, wordpress not allow links
The page I need help with: [log in to see the link]
- The topic ‘Convertion of Website into WordPress’ is closed to new replies.