I have an JSON object that I am trying to map. SO basically the JSON is like this:
{
  "Status": true, 
  "discounts": {
    "broker": {
      "discount": "1"
    }, 
    "dealer": {
      "discount": "0.7"
    }, 
    "individual": {
      "number_of_cars_discount": {
        "1": "1", 
        "10": "1", 
        "2": "0.98", 
        "3": "1", 
        "4": "1", 
      }
    }
  }
}
So I set the post and fetch the data.
const [posts, setPosts] = useState({});
  useEffect(() => {
    const fetchPosts = async () => {
      try {
        setLoading(true);
        const res = await Axios({
        });
        if (res.status == 200) {
          setPosts(res.data);
        }
        setLoading(false);
      } catch (err) {
        setError(err.message);
        setLoading(false);
      }
    };
    fetchPosts();
  }, []);
So to get the value and display it inside the table here is my code:
<tbody>
                    <td>
                  {Object.keys(posts).map((post, index) => (
                    <tr>
                      <div key={`broker-${index}`}>{post.discounts}</div>
                    </tr>
                  ))}
                </td>
                  </tbody>
But unfortunately, I am getting nothing. Thanks for your helps...
 
    