Closed ghost closed 4 years ago
Hi @Ali-Ghali,
You mean in testing? If that's what you're asking, them you don't want to do that. Read why here: https://kcd.im/imp-deets
hey, yes I mean in testing, I agree with you that it's redundant and I think it's not an issue to access the state in React-class based components, but still I need to access the state
value in function-hooks components, which is tricky, any idea how to do that?
thanks
No, I think you missed the point of the blog post. It shouldn't matter whether it's a class component or not. The internal state of your component should not be referenced in your test.
Hello Kent, hope you are doing well in these times, do you have an idea how to reach the value of state value like
const [players, setPlayers] = useState(["Ali", "kent"])
is there a way to assert the value of (players) the initial value?thaks