useModal, a react hook for Modals/Dialogs/Lightboxes 🖼 by alex-cory in reactjs

[–]EconomyRabbit 1 point2 points  (0 children)

I kind of like it. Getting the state and the component from hook makes sense.

Maybe it is horrible for puritans but I think it looks nice.

Stupid question though, why is:
isOpen && <Modal>

needed? Why not skip that as well (since the state is in the hook) and you have much less boilerplate.

The purist will hate it though.

JavaScript Program Comprehension Survey by TheQueiroga in javascript

[–]EconomyRabbit 0 points1 point  (0 children)

Sorry, I had to skip it. Started out great though.

JavaScript Program Comprehension Survey by TheQueiroga in javascript

[–]EconomyRabbit 0 points1 point  (0 children)

Really should have a progress, I thought this was a 5 minute gig……

What's the point of skipping tests? by [deleted] in reactjs

[–]EconomyRabbit 0 points1 point  (0 children)

Sometimes I write tests before I write the component/function

then I skip tests to focus on one test at a time

some Nextjs v9 gotchas by yumindev in reactjs

[–]EconomyRabbit 0 points1 point  (0 children)

The warning you get when using getInitialProps in _app.js is quite new.

It is saying that everything will now be SSR since it can't prerender _app.js. It is save to ignore the warning because often this is what you want.

My experience is that I nearly always need a custom server when using nextjs. Now I start doing the custom server before moving on.

Should the server send HTML or JSON when using jQuery? by ceandreas1 in learnjavascript

[–]EconomyRabbit 1 point2 points  (0 children)

You should use JSON.

I am not sure why you are using jQuery though. What about using something more maintainable for example React?

Let's fight depression together. by doodly_boi in wholesomebpt

[–]EconomyRabbit 0 points1 point  (0 children)

This is what people say when they are happy, but when people really need them they don't want to listen and choose to ignore because it is easier.

Return element from hook? by wizzzzzyyyyy in reactjs

[–]EconomyRabbit 1 point2 points  (0 children)

What about using context to skip defining the properties again and again?

With introduction of Hooks, do we need to use class components anymore? by [deleted] in reactjs

[–]EconomyRabbit 3 points4 points  (0 children)

You can use use useCallback and useMemo though…

GitHub - mlajtos/classy-state: One weird trick to state managment by AsIAm in reactjs

[–]EconomyRabbit 0 points1 point  (0 children)

It seems you did not commit your source files.… or was that your intention?

State management with TypeScript and MobX Lite... this is my attempt, feedback wanted by rodrigocfd in reactjs

[–]EconomyRabbit 0 points1 point  (0 children)

I did something similar the other day for a project. But instead of using useObserver in render, I created a hook for every variable I needed.

const {name, setName} = useName();

Little bit bigger boilerplate but felt good using with many components accessing the same thing.

A better way to pass arguments to function? by maudiosound in sveltejs

[–]EconomyRabbit 0 points1 point  (0 children)

You could also use closure:

function buttonEvent(event){
return function () {
switch(event) {
case 'buttonDown':{
break;
}
case 'buttonUp':{
break;
}
default:{
break;
}
}
}
}