![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
generator-kyper-react
Advanced tools
Generator for React/Redux projects that includes sub generators for Actions, Reducers, Components, and Containers.
Generator for a React projects that use Redux and are bundled with Webpack. There are also sub-generators for Components, Containers(Redux linked component), as well as Redux Actions and Reducers.
Install yeoman if you don't have it: using npm install -g yo
Install Generator: npm install -g generator-kyper-react
Create a project folder and enter it:
mkdir myProject && cd myProject
Initiate the generator:
yo kyper-react
To create a react component class named Test run: yo kyper-react:component Car
Creates a folder within /components
that matches the name provided. Below is the result of the command above being run:
/app
--/components
----/Car
------Car.js
------Car.scss
/app/components/Car.js:
import React, {Component, PropTypes} from 'react';
import './Car.scss';
class Car extends Component {
constructor(props){
super(props);
}
render(){
return (
<div className="Car">
</div>
);
}
}
export default Car
NOTE: Containers are synonymous with Smart Components and Linked-State Components
To create a container named Cars run: yo kyper-react:container Cars
Creates a folder within /containers
that matches the name provided. Below is the result of the command above being run:
/app
--/conatiners
----/Cars
------Cars.js
------Cars.scss
/app/containers/Cars.js:
import React, {Component, PropTypes} from 'react';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import * as Actions from '../../actions/cars';
import './Cars.scss';
class Cars extends Component {
constructor(props){
super(props);
}
static propTypes = {
};
render(){
return (
<div className="Cars">
</div>
);
}
}
//Place state of redux store into props of component
function mapStateToProps(state) {
return {
account: state.account,
router: state.router
};
}
//Place action methods into props
function mapDispatchToProps(dispatch) {
return bindActionCreators(Actions, dispatch);
}
export default connect(mapStateToProps, mapDispatchToProps)(Cars);
Actions are functions that are called from containers to make something happen to the state (i.e add a car).
To create a set of actions (add, update, remove) for cars run: yo kyper-react:action cars
Creates a folder within /actions
that matches the name provided. Below is the result of the command above being run:
/app
--/actions
----cars.js
/app/actions/cars.js:
export const ADD_CARS = 'ADD_CARS';
export const REMOVE_CARS = 'REMOVE_CARS';
export const UPDATE_CARS = 'UPDATE_CARS';
export function addCars(cars) {
return {
type: 'ADD_CARS',
payload: 'cars'
};
}
export function removeCars(cars) {
return {
type: 'REMOVE_CARS',
payload: 'cars'
};
}
export function updateCars(cars) {
return {
type: 'UPDATE_CARS',
payload: 'cars'
};
}
Reducers listen for actions and modify specific pieces of the state accordingly. In this example we are creating a cars reducer that manages state.cars, which is stored as an array.
yo kyper-react:reducer cars
then select array
app/
--/reducers
----cars.js
/app/reducers/cars.js:
import {
ADD_CAR,
UPDATE_CAR,
REMOVE_CAR,
} from '../actions/cars';
import {union, clone} from 'lodash';
export default function cars(state = [], action) {
switch (action.type) {
case ADD_CAR:
if(!action.payload){
console.error('Payload required to add a cars');
return state;
}
return [...state, action.payload];
break;
case UPDATE_CAR:
if(!action.index && action.payload){
console.error('Index and payload required to update a cars');
return state;
}
if(!state[action.name]){
console.error('cars with that name already exists');
return state;
}
let newState = clone(state);
newState[action.index] = action.payload;
return newState;
break;
case REMOVE_CAR:
if(!action.index){
console.error('Index required to delete a cars');
return state;
}
if(!state[action.index]){
console.error('cars at that index does not exist');
return state;
}
let newState = clone(state);
delete newState[action.index];
return newState;
break;
default:
return state;
}
}
FAQs
Generator for React/Redux projects that includes sub generators for Actions, Reducers, Components, and Containers.
The npm package generator-kyper-react receives a total of 9 weekly downloads. As such, generator-kyper-react popularity was classified as not popular.
We found that generator-kyper-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.