Sometime we need to access the value of state before react completes in work of state update, it’s kind of live value that would eventually be stored in the state variable of react. e.g. there may be function which needs latest value of state in the same event loop and may cause issues if it
Category Archives: React
Eject the configurations using following command: Install less and less-loader: Change the following in webpack.config.js That’s it. You are done. Cheers and Peace out!!!
This is a simple pattern that will provide react hook and react higher component to get the state from redux and register the actions. First create a ts file with an initial state, reducers, and saga effects: In the above code, the namespace must be the first part of the type in effects and reducers
Right now creat-react-app supports SASS by default. So to add less support we need to eject first and then edit “webpack.config.js” file. To eject configuration run following command: And install less loader and less Now search following: And replace with Now we need to replace SASS loader with less loader. Find the following lines: in
Means any (.tsx) file in your src folder (its sub-folders) cannot be blank or cannot just have simple functions without any export statement.
useState() : Takes One argument – the initial value of variable Uses Array destructuring feature. e.g. := const [variableName, functionName] = useState(value) Where : variableName : that will be stored in state functionName: The that will be used to set the value of variableName value : the initial value of variable variableName useEffect() : The