Posted on

kajkbahja

import React from 'react';
import { useSelector, useDispatch } from 'react-redux'; // Step 9: Import hooks to use Redux state
import { increment, decrement, reset } from './features/counterSlice'; // Step 10: Import actions

function App() {
  const counter = useSelector((state) => state.counter.value); // Step 11: Get the counter value from Redux
  const dispatch = useDispatch(); // Step 12: Use dispatch to send actions

  return (
    <div style="{{">
      <h1>Redux Counter: {counter}</h1>
      <button> dispatch(increment())}&gt;+1</button> {/* Step 13: Increment counter */}
      <button> dispatch(decrement())}&gt;-1</button> {/* Step 14: Decrement counter */}
      <button> dispatch(reset())}&gt;Reset</button> {/* Step 15: Reset counter */}
    </div>
  );
}

export default App;