
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A simple, functional approach to React
Globally install parcel.js (This is the project bundler).
npm install -g parcel-bundler
Globally install douglas (This unwraps the seed project )
npm install -g douglas
Get react-fn-seed and install using douglas
douglas get react-fn-seed
Now you can run using npm start
React-fn is a functional approach to React. Take a look at this basic app below. You'll notice that State and Actions are decoupled from Components altogether, making things clean and simple.
// global state
const state = {
greeting: 'hello world'
};
// functional component has state and actions passed in
const MyComponent = ({ state, actions }) => (
<div>
<h1>{state.greeting}</h1>
<button onClick={ actions.changeGreeting('hello ben') }>Change greeting</button>
{/* Pass state and actions into any child components */}
<childComponent state={state} actions={actions}></childComponent>
</div>
);
// actions have the fn api passed in and fn.updateState can be used to update the App's State
const actions = (fn) => {
changeGreeting: (fn) => (newGreeting) => fn.updateState('greeting', newGreeting)
}
// This is where your app will be mounted
const mount = document.querySelector('#app');
// run your app
app(state, MyComponent, actions, mount);
Actions are functions that cause side-effects (Usually state changes).
As you can see above, Actions are passed in to the first component.
Actions are then passed down to child components.
Actions can also be passed into actions to enable action-chaining.
Rather than State existing within components, it is stored in a single State object.
State is just a pure javascript object (no methods).
State is passed into the first component and can be passed down to child components.
Changing state is done by Actions via the fn.updateState method...
Let's say your state is
some: {
nested: {
node: 'hello'
}
}
and you want to make a change to some.nested.node, then...
fn.updateState('some/nested/node', 'here i am');
State is now changed to
some: {
nested: {
node: 'here i am'
}
}
Whenever fn.updateState is called, the app is rerendered, unless the flag rerender: false is passed in ...
// The following will not rerender the app
fn.updateState('some/nested/node', 'here i am', { rerender: false });
https://github.com/attack-monkey/react-fn/tree/develop/docs/TOC.md
FAQs
The Functional Approach to React
We found that react-fn demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.